Skip to content

Commit 3c25dd2

Browse files
committed
added option to select protocol. Added more docker makefile commands to make ease of dev easier.
1 parent 6136e2c commit 3c25dd2

File tree

5 files changed

+18
-5
lines changed

5 files changed

+18
-5
lines changed

Dockerfile

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ FROM python:3.9-slim
22

33
COPY requirements.txt /requirements.txt
44

5-
RUN pip install -r /requirements.txt
5+
RUN pip install -r /requirements.txt && mkdir /app
66

7-
ADD LICENSE run.py script/* /
7+
WORKDIR /app
88

9-
ENTRYPOINT [ "python3", "/run.py" ]
9+
COPY LICENSE run.py /app/
10+
COPY script /app/script
11+
12+
ENTRYPOINT [ "python3", "./run.py" ]

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,9 @@ docker-build:
2626
docker-push: docker-build
2727
docker push ${DOCKER_REPO}:latest
2828
docker push ${DOCKER_REPO}:${DOCKER_TAG}
29+
30+
docker-run: docker-build
31+
docker run --mount 'type=bind,source=${PWD},target=/data' ${DOCKER_REPO}:${DOCKER_TAG} --config /data/config.yml --bind /data/example.csv
32+
33+
docker-explore: docker-build
34+
docker run -it --entrypoint /bin/bash --mount 'type=bind,source=${PWD},target=/data' ${DOCKER_REPO}:${DOCKER_TAG} -o vi

run.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def setup_logger():
3535
)
3636
handler = logging.StreamHandler()
3737
handler.setFormatter(formatter)
38-
logger.setLevel(logging.INFO)
38+
logger.setLevel(logging.DEBUG)
3939
logger.addHandler(handler)
4040

4141
if __name__ == "__main__":

script/config.py

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def __init__(self, config_path):
1414

1515
GRAFANA_AUTH = ""
1616
GRAFANA_URL = ""
17+
GRAFANA_PROTOCOL = "http"
1718

1819
LDAP_SERVER_URL = ""
1920
LDAP_PORT = ""
@@ -46,6 +47,8 @@ def load_config(self, config_path):
4647
config["grafana"]["password"]
4748
)
4849
self.GRAFANA_URL = config["grafana"]["url"]
50+
if config["grafana"]["protocol"]:
51+
self.GRAFANA_PROTOCOL = config["grafana"]["protocol"]
4952

5053
self.LDAP_SERVER_URL = config["ldap"]["url"]
5154
self.LDAP_PORT = config["ldap"]["port"]

script/grafana.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ def setup_grafana(config_dict):
1515
configuration = config_dict
1616
grafana_api = GrafanaFace(
1717
auth=configuration.GRAFANA_AUTH,
18-
host=configuration.GRAFANA_URL
18+
host=configuration.GRAFANA_URL,
19+
protocol=configuration.GRAFANA_PROTOCOL
1920
)
2021

2122

0 commit comments

Comments
 (0)