This is an automated email from the ASF dual-hosted git repository.
jiacai2050 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-horaedb.git
The following commit(s) were added to refs/heads/main by this push:
new cf5ec104 chore: add mysql-client and grafana in docker image (#1530)
cf5ec104 is described below
commit cf5ec10406d90290e1b9d557805e95c82520d507
Author: Draco <[email protected]>
AuthorDate: Sun May 12 08:27:03 2024 +0800
chore: add mysql-client and grafana in docker image (#1530)
## Rationale
Close #1285
Install mysql-client and grafana when building docker image.
## Detailed Changes
1. Install mysql-client and grafana in Dockerfile.
2. Add docker/datasource.yml as grafana default datasource.
3. Start grafana server in entrypoint.sh.
### mysql-client
In the docker container:
<img width="640" alt="image"
src="https://github.com/apache/incubator-horaedb/assets/55609330/5c59fd23-c54e-4761-8833-51355a81fada">
### grafana
Start the container and access http://<your_ip>:3000
<img width="1438" alt="image"
src="https://github.com/apache/incubator-horaedb/assets/55609330/34a2718e-3803-4e01-b384-39ca64dea7b7">
## Test Plan
None.
---
Dockerfile | 11 ++++++++++-
docker/{entrypoint.sh => datasource.yml} | 29 ++++++++++++-----------------
docker/entrypoint.sh | 3 +++
3 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/Dockerfile b/Dockerfile
index 6e94e51a..1229e4a2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -35,9 +35,18 @@ FROM ubuntu:20.04
RUN useradd -m -s /bin/bash horae
RUN apt update && \
- apt install --yes curl gdb iotop cron vim less net-tools && \
+ apt install --yes curl gdb iotop cron vim less net-tools mysql-client
apt-transport-https software-properties-common wget && \
apt clean
+# install grafana
+RUN mkdir -p /etc/apt/keyrings/ && \
+ wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | tee
/etc/apt/keyrings/grafana.gpg > /dev/null && \
+ echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg]
https://apt.grafana.com stable main" | tee -a
/etc/apt/sources.list.d/grafana.list && \
+ apt update && \
+ apt install --yes grafana && \
+ apt clean
+COPY ./docker/datasource.yml /usr/share/grafana/conf/provisioning/datasources
+
ENV RUST_BACKTRACE 1
COPY --from=build /horaedb/target/release/horaedb-server
/usr/bin/horaedb-server
diff --git a/docker/entrypoint.sh b/docker/datasource.yml
old mode 100755
new mode 100644
similarity index 65%
copy from docker/entrypoint.sh
copy to docker/datasource.yml
index abb58817..acdeadc5
--- a/docker/entrypoint.sh
+++ b/docker/datasource.yml
@@ -1,4 +1,3 @@
-#!/usr/bin/env bash
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
@@ -16,21 +15,17 @@
# specific language governing permissions and limitations
# under the License.
+apiVersion: 1
-set -exo pipefail
+datasources:
+ - name: HoraeDB-mysql
+ type: mysql
+ access: proxy
+ url: localhost:3307
+ isDefault: true
-## init varibles
-USER="horae"
-DATA_DIR="/home/${USER}/data"
-DATA_PATH="${DATA_DIR}/horaedb"
-CONFIG_FILE="/etc/horaedb/horaedb.toml"
-
-# enable jemalloc heap profiling
-export MALLOC_CONF="prof:true,prof_active:false,lg_prof_sample:19"
-
-## data dir
-mkdir -p ${DATA_DIR}
-chmod +777 -R ${DATA_DIR}
-chown -R ${USER}.${USER} ${DATA_DIR}
-
-exec /usr/bin/horaedb-server --config ${CONFIG_FILE}
+ - name: HoraeDB-influxdb
+ type: influxdb
+ access: proxy
+ url: http://localhost:5440/influxdb/v1/
+ isDefault: false
\ No newline at end of file
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index abb58817..19523793 100755
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -33,4 +33,7 @@ mkdir -p ${DATA_DIR}
chmod +777 -R ${DATA_DIR}
chown -R ${USER}.${USER} ${DATA_DIR}
+# start grafana server
+nohup /usr/share/grafana/bin/grafana server --homepath /usr/share/grafana/ &
+
exec /usr/bin/horaedb-server --config ${CONFIG_FILE}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]