diff --git a/Dockerfile b/Dockerfile index 6e94e51a70..1229e4a25d 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/datasource.yml b/docker/datasource.yml new file mode 100644 index 0000000000..acdeadc546 --- /dev/null +++ b/docker/datasource.yml @@ -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 \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index abb588173d..19523793d8 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}