This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb-extras.git


The following commit(s) were added to refs/heads/master by this push:
     new bb248c0  chore: Moved the Docker-related stuff for extras modules to 
the extras repo
bb248c0 is described below

commit bb248c047e8948d8c1688e6a547e705249f0525e
Author: Christofer Dutz <[email protected]>
AuthorDate: Thu Apr 18 14:27:40 2024 +0200

    chore: Moved the Docker-related stuff for extras modules to the extras repo
---
 docker/ReadMe.md                                   | 66 ++++++++++++++++++++++
 .../GrafanaPlugin/Dockerfile-0.14.0-iotdb          | 42 ++++++++++++++
 .../DockerCompose/GrafanaPlugin/docker-compose.yml | 48 ++++++++++++++++
 .../main/DockerCompose/docker-compose-grafana.yml  | 50 ++++++++++++++++
 docker/src/main/Dockerfile-0.12.6-grafana          | 41 ++++++++++++++
 .../src/main/Dockerfile-0.13.3-grafana-connector   | 41 ++++++++++++++
 6 files changed, 288 insertions(+)

diff --git a/docker/ReadMe.md b/docker/ReadMe.md
new file mode 100644
index 0000000..b887443
--- /dev/null
+++ b/docker/ReadMe.md
@@ -0,0 +1,66 @@
+<!--
+
+    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.
+
+-->
+
+# How to run IoTDB-grafana-connector
+
+1. First way: use config file:
+
+```
+docker run -it -v 
/your_application.properties_folder:/iotdb-grafana-connector/config -p 
8888:8888 apache/iotdb:<version>-grafana
+```
+
+2. Second way: use environment(take `SPRING_DATASOURCE_URL` for example)
+
+```
+docker run -it -p 8888:8888 apache/iotdb:<version>-grafana -e 
SPRING_DATASOURCE_URL=jdbc:iotdb://iotdb:6667/
+```
+
+3. All related environment are as follows(more details in 
`grafana/src/main/resources/application.properties`)
+
+| name                                | default value                     |
+| ----------------------------------- | --------------------------------- |
+| SPRING_DATASOURCE_URL               | jdbc:iotdb://127.0.0.1:6667/      |
+| SPRING_DATASOURCE_USERNAME          | root                              |
+| SPRING_DATASOURCE_PASSWORD          | root                              |
+| SPRING_DATASOURCE_DRIVER_CLASS_NAME | org.apache.iotdb.jdbc.IoTDBDriver |
+| SERVER_PORT                         | 8888                              |
+| TIMESTAMP_PRECISION                 | ms                                |
+| ISDOWNSAMPLING                      | true                              |
+| INTERVAL                            | 1m                                |
+| CONTINUOUS_DATA_FUNCTION            | AVG                               |
+| DISCRETE_DATA_FUNCTION              | LAST_VALUE                        |
+
+# How to run IoTDB-grafana-connector by docker compose
+> Using docker compose, it contains three services: iotdb, grafana and 
grafana-connector
+
+1. The location of docker compose file: 
`/docker/src/main/DockerCompose/docker-compose-grafana.yml`
+2. Use `docker-compose up` can start all three services
+    1. you can use `docker-compose up -d` to start in the background
+    2. you can modify `docker-compose-grafana.yml` to implement your 
requirements.
+        1. you can modify environment of grafana-connector
+        2. If you want to **SAVE ALL DATA**, please use `volumes` keyword to 
mount the data volume or file of the host into the container.
+3. After all services are start, you can visit `{ip}:3000` to visit grafana
+    1. In `Configuration`, search `SimpleJson`
+    2. Fill in url: `grafana-connector:8888`, then click `save and test`. if 
`Data source is working` is shown, the configuration is finished.
+    3. Then you can create dashboards.
+4. if you want to stop services, just run `docker-compose down`
+
+Enjoy it!
diff --git 
a/docker/src/main/DockerCompose/GrafanaPlugin/Dockerfile-0.14.0-iotdb 
b/docker/src/main/DockerCompose/GrafanaPlugin/Dockerfile-0.14.0-iotdb
new file mode 100644
index 0000000..421b7f2
--- /dev/null
+++ b/docker/src/main/DockerCompose/GrafanaPlugin/Dockerfile-0.14.0-iotdb
@@ -0,0 +1,42 @@
+#
+# 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.
+#
+
+FROM openjdk:11-jre-slim
+RUN apt update \
+  # procps is for `free` command
+  && apt install wget unzip lsof procps -y \
+  && wget 
https://downloads.apache.org/iotdb/0.14.0/apache-iotdb-0.14.0-server-bin.zip \
+  # if you are in China, use the following URL
+  #&& wget 
https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.14.0/apache-iotdb-0.14.0-server-bin.zip
 \
+  && unzip apache-iotdb-0.14.0-server-bin.zip \
+  && rm apache-iotdb-0.14.0-server-bin.zip \
+  && mv apache-iotdb-0.14.0-server-bin /iotdb \
+  && apt remove wget unzip -y \
+  && apt autoremove -y \
+  && apt purge --auto-remove -y \
+  && apt clean -y
+EXPOSE 6667
+EXPOSE 31999
+EXPOSE 5555
+EXPOSE 8181
+EXPOSE 18080
+VOLUME /iotdb/data
+VOLUME /iotdb/logs
+ENV PATH="/iotdb/sbin/:/iotdb/tools/:${PATH}"
+ENTRYPOINT ["/iotdb/sbin/start-server.sh"]
diff --git a/docker/src/main/DockerCompose/GrafanaPlugin/docker-compose.yml 
b/docker/src/main/DockerCompose/GrafanaPlugin/docker-compose.yml
new file mode 100644
index 0000000..26a9047
--- /dev/null
+++ b/docker/src/main/DockerCompose/GrafanaPlugin/docker-compose.yml
@@ -0,0 +1,48 @@
+#
+# 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.
+#
+
+version: "3.7"
+
+services:
+  grafana:
+    image: grafana/grafana:8.2.5
+    ports:
+      - 3000:3000
+    environment:
+      - GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=iotdb
+      - 
GF_INSTALL_PLUGINS=https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.14.0/apache-iotdb-0.14.0-grafana-plugin-bin.zip;apache-iotdb-0.14.0-grafana-plugin-bin
+  iotdb:
+    image: apache/iotdb0.14
+    build:
+      context: ./
+      dockerfile: Dockerfile-0.14.0-iotdb
+    volumes:
+      - ./iotdb/conf/iotdb-rest.properties:/iotdb/conf/iotdb-rest.properties
+      - ./iotdb/data/:/iotdb/data
+      - ./iotdb/logs:/iotdb/logs
+    ports:
+      - 6667:6667
+      - 18080:18080
+      - 5555:5555
+      - 31999:31999
+      - 8181:8181
+  alertmanager:
+    image: prom/alertmanager:v0.21.0
+    ports:
+      - 9093:9093
\ No newline at end of file
diff --git a/docker/src/main/DockerCompose/docker-compose-grafana.yml 
b/docker/src/main/DockerCompose/docker-compose-grafana.yml
new file mode 100644
index 0000000..bd80ff7
--- /dev/null
+++ b/docker/src/main/DockerCompose/docker-compose-grafana.yml
@@ -0,0 +1,50 @@
+#
+# 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.
+#
+
+version: "2"
+
+services:
+    iotdb:
+      image: apache/iotdb
+      ports:
+        - 6667:6667
+      container_name: "iotdb"
+    grafana:
+      image: grafana/grafana
+      ports:
+        - 3000:3000
+      environment:
+        - GF_INSTALL_PLUGINS=grafana-simple-json-datasource
+      container_name: "grafana"
+    grafana-connector:
+      image: apache/iotdb:0.12.2-grafana
+      environment:
+        - SPRING_DATASOURCE_URL=jdbc:iotdb://iotdb:6667/
+        - SPRING_DATASOURCE_USERNAME=root
+        - SPRING_DATASOURCE_PASSWORD=root
+        - SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.apache.iotdb.jdbc.IoTDBDriver
+        - SERVER_PORT=8888
+        - TIMESTAMP_PRECISION=ms
+        - ISDOWNSAMPLING=true
+        - INTERVAL=1m
+        - CONTINUOUS_DATA_FUNCTION=AVG
+        - DISCRETE_DATA_FUNCTION=LAST_VALUE
+      ports:
+        - 8888:8888
+      container_name: "grafana-connector"
diff --git a/docker/src/main/Dockerfile-0.12.6-grafana 
b/docker/src/main/Dockerfile-0.12.6-grafana
new file mode 100644
index 0000000..8140673
--- /dev/null
+++ b/docker/src/main/Dockerfile-0.12.6-grafana
@@ -0,0 +1,41 @@
+#
+# 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.
+#
+
+FROM openjdk:11-jre-slim
+RUN apt update \
+  # procps is for `free` command
+  && apt install wget unzip lsof procps -y \
+  && wget 
https://downloads.apache.org/iotdb/0.12.6/apache-iotdb-0.12.6-grafana-bin.zip \
+  # if you are in China, use the following URL
+  #&& wget 
https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.12.6/apache-iotdb-0.12.6-grafana-bin.zip
 \
+  && unzip apache-iotdb-0.12.6-grafana-bin.zip \
+  && rm apache-iotdb-0.12.6-grafana-bin.zip \
+  && mv apache-iotdb-0.12.6-grafana-bin /iotdb-grafana \
+  && apt remove wget unzip -y \
+  && apt autoremove -y \
+  && apt purge --auto-remove -y \
+  && apt clean -y
+# rpc port
+EXPOSE 8888
+VOLUME /iotdb-grafana/config
+RUN echo "#!/bin/bash" > /iotdb-grafana/runboot.sh
+RUN echo "java -Djava.security.egd=file:/dev/./urandom -jar 
/iotdb-grafana/iotdb-grafana.war" >> /iotdb-grafana/runboot.sh
+RUN chmod a+x /iotdb-grafana/runboot.sh
+WORKDIR /iotdb-grafana
+ENTRYPOINT ["./runboot.sh"]
diff --git a/docker/src/main/Dockerfile-0.13.3-grafana-connector 
b/docker/src/main/Dockerfile-0.13.3-grafana-connector
new file mode 100644
index 0000000..573b6ee
--- /dev/null
+++ b/docker/src/main/Dockerfile-0.13.3-grafana-connector
@@ -0,0 +1,41 @@
+#
+# 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.
+#
+
+FROM openjdk:11-jre-slim
+RUN apt update \
+  # procps is for `free` command
+  && apt install wget unzip lsof procps -y \
+  && wget 
https://downloads.apache.org/iotdb/0.13.3/apache-iotdb-0.13.3-grafana-connector-bin.zip
 \
+  # if you are in China, use the following URL
+  #&& wget 
https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.13.3/apache-iotdb-0.13.3-grafana-connector-bin.zip
 \
+  && unzip apache-iotdb-0.13.3-grafana-connector-bin.zip \
+  && rm apache-iotdb-0.13.3-grafana-connector-bin.zip \
+  && mv apache-iotdb-0.13.3-grafana-connector-bin /iotdb-grafana-connector \
+  && apt remove wget unzip -y \
+  && apt autoremove -y \
+  && apt purge --auto-remove -y \
+  && apt clean -y
+# rpc port
+EXPOSE 8888
+VOLUME /iotdb-grafana-connector/config
+RUN echo "#!/bin/bash" > /iotdb-grafana-connector/runboot.sh
+RUN echo "java -Djava.security.egd=file:/dev/./urandom -jar 
/iotdb-grafana-connector/iotdb-grafana-connector.war" >> 
/iotdb-grafana-connector/runboot.sh
+RUN chmod a+x /iotdb-grafana-connector/runboot.sh
+WORKDIR /iotdb-grafana-connector
+ENTRYPOINT ["./runboot.sh"]

Reply via email to