diff --git a/Dockerfile b/Dockerfile index 596216a9b35f0e8881034fc967aad1b904a9e342..dad653451fee7223605368c31d6b8d858e00f84d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,8 +8,9 @@ RUN apt-get update \ COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt -COPY wait-for-it.sh . -RUN chmod +x wait-for-it.sh +COPY *.html . +COPY *.sh . +RUN chmod +x *.sh COPY *.py . CMD ["python", "main.py"] diff --git a/docker-compose.yml b/docker-compose.yml index 858493dc8b20f53b11b0893064caecdbb2d8aa98..990be541141ac773d22826569e934f6663dc84da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,4 @@ services: - monitor: build: . init: true @@ -13,6 +12,28 @@ services: - postgres command: ["./wait-for-it.sh", "postgres:5432", "--", "python", "main.py"] + visualize: + build: . + init: true + restart: unless-stopped + environment: + - DB_HOST=postgres + - DB_NAME=response_times + - DB_USER=myuser + - DB_PASSWORD=mypassword + depends_on: + - postgres + - monitor + ports: + - 12923:12923 + command: + [ + "./wait-for-it.sh", + "postgres:5432", + "--", + "./run_visualize_webserver.sh", + ] + postgres: image: postgres:13 restart: unless-stopped diff --git a/run_visualize_webserver.sh b/run_visualize_webserver.sh new file mode 100644 index 0000000000000000000000000000000000000000..1a8acba80b193f6d24c78880bc431402e52d2800 --- /dev/null +++ b/run_visualize_webserver.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +python export.py > exported.csv +mkdir -p /var/www/html +mv exported.csv /var/www/html +cp visualize.html /var/www/html + +cd /var/www/html +python3 -m http.server 12923 \ No newline at end of file