Skip to content

Commit bb248c0

Browse files
committed
chore: Moved the Docker-related stuff for extras modules to the extras repo
1 parent face1d4 commit bb248c0

File tree

6 files changed

+288
-0
lines changed

6 files changed

+288
-0
lines changed

docker/ReadMe.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<!--
2+
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
20+
-->
21+
22+
# How to run IoTDB-grafana-connector
23+
24+
1. First way: use config file:
25+
26+
```
27+
docker run -it -v /your_application.properties_folder:/iotdb-grafana-connector/config -p 8888:8888 apache/iotdb:<version>-grafana
28+
```
29+
30+
2. Second way: use environment(take `SPRING_DATASOURCE_URL` for example)
31+
32+
```
33+
docker run -it -p 8888:8888 apache/iotdb:<version>-grafana -e SPRING_DATASOURCE_URL=jdbc:iotdb://iotdb:6667/
34+
```
35+
36+
3. All related environment are as follows(more details in `grafana/src/main/resources/application.properties`)
37+
38+
| name | default value |
39+
| ----------------------------------- | --------------------------------- |
40+
| SPRING_DATASOURCE_URL | jdbc:iotdb://127.0.0.1:6667/ |
41+
| SPRING_DATASOURCE_USERNAME | root |
42+
| SPRING_DATASOURCE_PASSWORD | root |
43+
| SPRING_DATASOURCE_DRIVER_CLASS_NAME | org.apache.iotdb.jdbc.IoTDBDriver |
44+
| SERVER_PORT | 8888 |
45+
| TIMESTAMP_PRECISION | ms |
46+
| ISDOWNSAMPLING | true |
47+
| INTERVAL | 1m |
48+
| CONTINUOUS_DATA_FUNCTION | AVG |
49+
| DISCRETE_DATA_FUNCTION | LAST_VALUE |
50+
51+
# How to run IoTDB-grafana-connector by docker compose
52+
> Using docker compose, it contains three services: iotdb, grafana and grafana-connector
53+
54+
1. The location of docker compose file: `/docker/src/main/DockerCompose/docker-compose-grafana.yml`
55+
2. Use `docker-compose up` can start all three services
56+
1. you can use `docker-compose up -d` to start in the background
57+
2. you can modify `docker-compose-grafana.yml` to implement your requirements.
58+
1. you can modify environment of grafana-connector
59+
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.
60+
3. After all services are start, you can visit `{ip}:3000` to visit grafana
61+
1. In `Configuration`, search `SimpleJson`
62+
2. Fill in url: `grafana-connector:8888`, then click `save and test`. if `Data source is working` is shown, the configuration is finished.
63+
3. Then you can create dashboards.
64+
4. if you want to stop services, just run `docker-compose down`
65+
66+
Enjoy it!
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
FROM openjdk:11-jre-slim
21+
RUN apt update \
22+
# procps is for `free` command
23+
&& apt install wget unzip lsof procps -y \
24+
&& wget https://downloads.apache.org/iotdb/0.14.0/apache-iotdb-0.14.0-server-bin.zip \
25+
# if you are in China, use the following URL
26+
#&& wget https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.14.0/apache-iotdb-0.14.0-server-bin.zip \
27+
&& unzip apache-iotdb-0.14.0-server-bin.zip \
28+
&& rm apache-iotdb-0.14.0-server-bin.zip \
29+
&& mv apache-iotdb-0.14.0-server-bin /iotdb \
30+
&& apt remove wget unzip -y \
31+
&& apt autoremove -y \
32+
&& apt purge --auto-remove -y \
33+
&& apt clean -y
34+
EXPOSE 6667
35+
EXPOSE 31999
36+
EXPOSE 5555
37+
EXPOSE 8181
38+
EXPOSE 18080
39+
VOLUME /iotdb/data
40+
VOLUME /iotdb/logs
41+
ENV PATH="/iotdb/sbin/:/iotdb/tools/:${PATH}"
42+
ENTRYPOINT ["/iotdb/sbin/start-server.sh"]
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
version: "3.7"
21+
22+
services:
23+
grafana:
24+
image: grafana/grafana:8.2.5
25+
ports:
26+
- 3000:3000
27+
environment:
28+
- GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS=iotdb
29+
- 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
30+
iotdb:
31+
image: apache/iotdb0.14
32+
build:
33+
context: ./
34+
dockerfile: Dockerfile-0.14.0-iotdb
35+
volumes:
36+
- ./iotdb/conf/iotdb-rest.properties:/iotdb/conf/iotdb-rest.properties
37+
- ./iotdb/data/:/iotdb/data
38+
- ./iotdb/logs:/iotdb/logs
39+
ports:
40+
- 6667:6667
41+
- 18080:18080
42+
- 5555:5555
43+
- 31999:31999
44+
- 8181:8181
45+
alertmanager:
46+
image: prom/alertmanager:v0.21.0
47+
ports:
48+
- 9093:9093
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
version: "2"
21+
22+
services:
23+
iotdb:
24+
image: apache/iotdb
25+
ports:
26+
- 6667:6667
27+
container_name: "iotdb"
28+
grafana:
29+
image: grafana/grafana
30+
ports:
31+
- 3000:3000
32+
environment:
33+
- GF_INSTALL_PLUGINS=grafana-simple-json-datasource
34+
container_name: "grafana"
35+
grafana-connector:
36+
image: apache/iotdb:0.12.2-grafana
37+
environment:
38+
- SPRING_DATASOURCE_URL=jdbc:iotdb://iotdb:6667/
39+
- SPRING_DATASOURCE_USERNAME=root
40+
- SPRING_DATASOURCE_PASSWORD=root
41+
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.apache.iotdb.jdbc.IoTDBDriver
42+
- SERVER_PORT=8888
43+
- TIMESTAMP_PRECISION=ms
44+
- ISDOWNSAMPLING=true
45+
- INTERVAL=1m
46+
- CONTINUOUS_DATA_FUNCTION=AVG
47+
- DISCRETE_DATA_FUNCTION=LAST_VALUE
48+
ports:
49+
- 8888:8888
50+
container_name: "grafana-connector"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
FROM openjdk:11-jre-slim
21+
RUN apt update \
22+
# procps is for `free` command
23+
&& apt install wget unzip lsof procps -y \
24+
&& wget https://downloads.apache.org/iotdb/0.12.6/apache-iotdb-0.12.6-grafana-bin.zip \
25+
# if you are in China, use the following URL
26+
#&& wget https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.12.6/apache-iotdb-0.12.6-grafana-bin.zip \
27+
&& unzip apache-iotdb-0.12.6-grafana-bin.zip \
28+
&& rm apache-iotdb-0.12.6-grafana-bin.zip \
29+
&& mv apache-iotdb-0.12.6-grafana-bin /iotdb-grafana \
30+
&& apt remove wget unzip -y \
31+
&& apt autoremove -y \
32+
&& apt purge --auto-remove -y \
33+
&& apt clean -y
34+
# rpc port
35+
EXPOSE 8888
36+
VOLUME /iotdb-grafana/config
37+
RUN echo "#!/bin/bash" > /iotdb-grafana/runboot.sh
38+
RUN echo "java -Djava.security.egd=file:/dev/./urandom -jar /iotdb-grafana/iotdb-grafana.war" >> /iotdb-grafana/runboot.sh
39+
RUN chmod a+x /iotdb-grafana/runboot.sh
40+
WORKDIR /iotdb-grafana
41+
ENTRYPOINT ["./runboot.sh"]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
#
19+
20+
FROM openjdk:11-jre-slim
21+
RUN apt update \
22+
# procps is for `free` command
23+
&& apt install wget unzip lsof procps -y \
24+
&& wget https://downloads.apache.org/iotdb/0.13.3/apache-iotdb-0.13.3-grafana-connector-bin.zip \
25+
# if you are in China, use the following URL
26+
#&& wget https://mirrors.tuna.tsinghua.edu.cn/apache/iotdb/0.13.3/apache-iotdb-0.13.3-grafana-connector-bin.zip \
27+
&& unzip apache-iotdb-0.13.3-grafana-connector-bin.zip \
28+
&& rm apache-iotdb-0.13.3-grafana-connector-bin.zip \
29+
&& mv apache-iotdb-0.13.3-grafana-connector-bin /iotdb-grafana-connector \
30+
&& apt remove wget unzip -y \
31+
&& apt autoremove -y \
32+
&& apt purge --auto-remove -y \
33+
&& apt clean -y
34+
# rpc port
35+
EXPOSE 8888
36+
VOLUME /iotdb-grafana-connector/config
37+
RUN echo "#!/bin/bash" > /iotdb-grafana-connector/runboot.sh
38+
RUN echo "java -Djava.security.egd=file:/dev/./urandom -jar /iotdb-grafana-connector/iotdb-grafana-connector.war" >> /iotdb-grafana-connector/runboot.sh
39+
RUN chmod a+x /iotdb-grafana-connector/runboot.sh
40+
WORKDIR /iotdb-grafana-connector
41+
ENTRYPOINT ["./runboot.sh"]

0 commit comments

Comments
 (0)