Skip to content

Commit 3680448

Browse files
committed
added another example
1 parent 4dc2c30 commit 3680448

4 files changed

Lines changed: 688 additions & 2 deletions

File tree

README.MD

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ The URL to the API backend is not provided here, for now, because it's not entir
77

88
If using docker-compose, the service will run 18:00, 18:30, 19:00, 19:30, 20:00 and 20:30, but you can change this in the `Dockerfile`.
99

10+
![heatmap](https://r0.fyi/strong?style=dark)
11+
1012
## Why?
1113

1214
So you can do fun stuff with your workout data, like doing silly grafana dashboards.
1315
For example, you can use the [Grafana Clickhouse plugin](https://grafana.com/grafana/plugins/grafana-clickhouse-datasource/) to visualize your workout data.
1416

15-
![heatmap](https://r0.fyi/strong?style=dark)
16-
1717
You can make heatmaps, like the one you have on github, or you can make a dashboard that shows your progress over time, or you can make a dashboard that shows your workout history.
1818

1919
![heatmap](./.github/heatmap.png)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Dockerfile
2+
#
3+
# Build and run without Docker Compose. You need a ClickHouse server running and accessible from the container.
4+
# You should use the docker compose from https://github.com/tolik518/strong-api-workout-fetch additionally to
5+
# have a ClickHouse server running with the workout data.
6+
#
7+
# docker build -t heatmap .
8+
# docker run -d --name heatmap \
9+
# --restart unless-stopped \
10+
# --network service-network \
11+
# -p 1337:80 \
12+
# -e CH_HOST=clickhouse-server \
13+
# -e CH_USER=tolik518 \
14+
# -e CH_PASS=admin \
15+
# -e CH_DB=workouts \
16+
# -e DEBUG=1 \
17+
# -v "$PWD/workout-heatmap.php":/var/www/html/index.php:ro \
18+
# heatmap
19+
#
20+
# Open: http://localhost:1337/
21+
#
22+
FROM php:8.2-apache
23+
24+
# GD-Extension für PNG/Text
25+
RUN apt-get update \
26+
&& apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev \
27+
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
28+
&& docker-php-ext-install -j$(nproc) gd \
29+
&& rm -rf /var/lib/apt/lists/*
30+
31+
COPY workout-heatmap.php /var/www/html/workout-heatmap.php
32+
33+
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf \
34+
&& echo "DirectoryIndex workout-heatmap.php" >> /etc/apache2/conf-enabled/docker-php.conf
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Docker Compose configuration intended for dev environment. It sets up a ClickHouse server and a PHP application to visualize workout data.
2+
services:
3+
heatmap:
4+
build: .
5+
container_name: heatmap
6+
ports:
7+
- "1337:80"
8+
volumes:
9+
- ./workout-heatmap.php:/var/www/html/workout-heatmap.php
10+
environment:
11+
- CH_HOST=clickhouse-server
12+
- CH_PORT=8123
13+
- CH_DB=workouts
14+
- CH_USER=tolik518
15+
- CH_PASS=admin
16+
- CH_PROTOCOL=http
17+
networks:
18+
- service-network
19+
depends_on:
20+
clickhouse-server:
21+
condition: service_healthy
22+
23+
clickhouse-server:
24+
image: clickhouse/clickhouse-server:latest
25+
container_name: clickhouse-server
26+
volumes:
27+
- ./clickhouse/data:/var/lib/clickhouse
28+
- ./clickhouse/init.sql:/docker-entrypoint-initdb.d/init.sql
29+
- /var/log/clickhouse-server:/var/log/clickhouse-server
30+
ports:
31+
- "8123:8123"
32+
- "9000:9000"
33+
environment:
34+
- CLICKHOUSE_DB=workouts
35+
- CLICKHOUSE_USER=tolik518
36+
- CLICKHOUSE_PASSWORD=admin
37+
healthcheck:
38+
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8123/ping"]
39+
interval: 5s
40+
timeout: 3s
41+
retries: 10
42+
networks:
43+
service-network:
44+
aliases:
45+
- clickhouse-server
46+
47+
networks:
48+
service-network:

0 commit comments

Comments
 (0)