Skip to content

Commit

Permalink
chore: add mysql-client and grafana in docker image (#1530)
Browse files Browse the repository at this point in the history
## 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.
  • Loading branch information
dracoooooo authored May 12, 2024
1 parent 148790c commit cf5ec10
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 31 additions & 0 deletions docker/datasource.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

apiVersion: 1

datasources:
- name: HoraeDB-mysql
type: mysql
access: proxy
url: localhost:3307
isDefault: true

- name: HoraeDB-influxdb
type: influxdb
access: proxy
url: http://localhost:5440/influxdb/v1/
isDefault: false
3 changes: 3 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}

0 comments on commit cf5ec10

Please sign in to comment.