-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introduce quickstart deployment mode (#1955)
* Introduce Quickstart deployment mode * resolve comments, include license,echo issue,creating separated folder. * Add the support to parse elements from pipelines and install the parsed elements * Delete comments * Addressed comments,including asset improbements, updating upload.sh, improvement of README file. * Improve the asset name, docker-compose.quickstart file and upload.sh file * Adjust the data explorer name * change the installer.xml to let example asset zip file not do the line ending transformations * Change the exclude path of asset file
- Loading branch information
1 parent
03a416c
commit 5b04827
Showing
6 changed files
with
327 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
# 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.4" | ||
|
||
# global logging | ||
x-logging: | ||
&default-logging | ||
options: | ||
max-size: '12m' | ||
max-file: '5' | ||
driver: json-file | ||
|
||
services: | ||
|
||
# StreamPipes services | ||
backend: | ||
image: "${SP_DOCKER_REGISTRY}/backend:${SP_VERSION}" | ||
depends_on: | ||
- consul | ||
- couchdb | ||
volumes: | ||
- backend:/root/.streampipes | ||
- files:/spImages | ||
logging: *default-logging | ||
restart: unless-stopped | ||
networks: | ||
spnet: | ||
|
||
ui: | ||
image: "${SP_DOCKER_REGISTRY}/ui:${SP_VERSION}" | ||
ports: | ||
- "80:8088" | ||
depends_on: | ||
- couchdb | ||
- consul | ||
- backend | ||
volumes: | ||
- nginx:/etc/nginx/ | ||
logging: *default-logging | ||
restart: unless-stopped | ||
networks: | ||
spnet: | ||
|
||
consul: | ||
image: consul:1.14.3 | ||
environment: | ||
- "CONSUL_LOCAL_CONFIG={\"disable_update_check\": true}" | ||
- "CONSUL_BIND_INTERFACE=eth0" | ||
- "CONSUL_HTTP_ADDR=0.0.0.0" | ||
entrypoint: | ||
- consul | ||
- agent | ||
- -server | ||
- -bootstrap-expect=1 | ||
- -data-dir=/consul/data | ||
- -node=consul-one | ||
- -bind={{ GetInterfaceIP "eth0" }} | ||
- -client=0.0.0.0 | ||
- -enable-script-checks=true | ||
- -ui | ||
volumes: | ||
- consul:/consul/data | ||
logging: *default-logging | ||
restart: unless-stopped | ||
networks: | ||
spnet: | ||
ipv4_address: ${SP_CONSUL_CONTAINER_IP} | ||
|
||
couchdb: | ||
image: couchdb:3.3.1 | ||
environment: | ||
- COUCHDB_USER=admin | ||
- COUCHDB_PASSWORD=admin | ||
volumes: | ||
- couchdb:/opt/couchdb/data | ||
logging: *default-logging | ||
restart: unless-stopped | ||
networks: | ||
spnet: | ||
|
||
kafka: | ||
image: fogsyio/kafka:2.2.0 | ||
hostname: kafka | ||
depends_on: | ||
- zookeeper | ||
environment: | ||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,OUTSIDE:PLAINTEXT | ||
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://:9092,OUTSIDE://localhost:9094 # Replace localhost with your external address if Kafka should be reachable from external systems. | ||
KAFKA_LISTENERS: PLAINTEXT://:9092,OUTSIDE://:9094 | ||
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT | ||
KAFKA_ADVERTISED_HOST_NAME: kafka | ||
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 | ||
KAFKA_MESSAGE_MAX_BYTES: 5000012 | ||
KAFKA_FETCH_MESSAGE_MAX_BYTES: 5000012 | ||
KAFKA_REPLICA_FETCH_MAX_BYTES: 10000000 | ||
volumes: | ||
- kafka:/kafka | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
logging: *default-logging | ||
restart: unless-stopped | ||
networks: | ||
spnet: | ||
|
||
zookeeper: | ||
image: fogsyio/zookeeper:3.4.13 | ||
volumes: | ||
- zookeeper:/opt/zookeeper-3.4.13 | ||
logging: *default-logging | ||
restart: unless-stopped | ||
networks: | ||
spnet: | ||
|
||
influxdb: | ||
image: influxdb:2.6 | ||
environment: | ||
- INFLUXDB_DATA_ENGINE=tsm1 | ||
- INFLUXDB_REPORTING_DISABLED=false | ||
- INFLUXDB_ADMIN_ENABLED=true | ||
- DOCKER_INFLUXDB_INIT_USERNAME=admin | ||
- DOCKER_INFLUXDB_INIT_PASSWORD=sp-admin | ||
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=sp-admin | ||
- DOCKER_INFLUXDB_INIT_ORG=sp | ||
- DOCKER_INFLUXDB_INIT_BUCKET=sp | ||
- DOCKER_INFLUXDB_INIT_MODE=${SP_INFLUX_INIT_MODE} | ||
volumes: | ||
- influxdb:/var/lib/influxdb | ||
- influxdb2:/var/lib/influxdb2 | ||
logging: *default-logging | ||
restart: unless-stopped | ||
networks: | ||
spnet: | ||
|
||
# Lite version pipeline elements | ||
extensions-all-jvm: | ||
image: "${SP_DOCKER_REGISTRY}/extensions-all-jvm:${SP_VERSION}" | ||
depends_on: | ||
- consul | ||
volumes: | ||
- files:/spImages | ||
logging: *default-logging | ||
restart: unless-stopped | ||
networks: | ||
spnet: | ||
|
||
script-runner: | ||
build: ./quickstart | ||
depends_on: | ||
- backend | ||
volumes: | ||
- ./quickstart/zip_folder:/zip_folder | ||
networks: | ||
spnet: | ||
|
||
|
||
|
||
volumes: | ||
backend: | ||
consul: | ||
connect: | ||
couchdb: | ||
kafka: | ||
zookeeper: | ||
influxdb: | ||
influxdb2: | ||
files: | ||
nginx: | ||
|
||
|
||
networks: | ||
spnet: | ||
driver: bridge | ||
ipam: | ||
config: | ||
- subnet: ${SP_SUBNET} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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. | ||
# Use an official base image | ||
FROM ubuntu:latest | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y curl jq | ||
|
||
COPY upload.sh /usr/local/bin/upload.sh | ||
RUN chmod +x /usr/local/bin/upload.sh | ||
|
||
CMD ["/usr/local/bin/upload.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/bin/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 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. | ||
|
||
#!/bin/bash | ||
if [ -z "$SP_INITIAL_ADMIN_EMAIL" ]; then | ||
USERNAME="[email protected]" | ||
else | ||
USERNAME="$SP_INITIAL_ADMIN_EMAIL" | ||
fi | ||
|
||
if [ -z "$SP_INITIAL_ADMIN_PASSWORD" ]; then | ||
PASSWORD="admin" | ||
else | ||
PASSWORD="$SP_INITIAL_ADMIN_PASSWORD" | ||
fi | ||
|
||
while true; do | ||
if curl -s "http://backend:8030/streampipes-backend/api/v2/auth/login" --max-time 10 &> /dev/null; then | ||
echo "StreamPipes backend is now ready!" | ||
break | ||
else | ||
echo "StreamPipes backend not ready, waiting for 3 seconds..." | ||
sleep 3 | ||
fi | ||
done | ||
|
||
JSON_TOKEN_RESPONSE=$(curl -s -X POST "http://backend:8030/streampipes-backend/api/v2/auth/login" \ | ||
-H "Content-Type: application/json" \ | ||
-d "{\"username\":\"$USERNAME\",\"password\":\"$PASSWORD\"}") | ||
|
||
TOKEN=$(echo "$JSON_TOKEN_RESPONSE" | jq -r '.accessToken') | ||
RESPONSE_TOKEN="Bearer $TOKEN" | ||
|
||
JSON_RESOURCE_ITEMS=$(curl -s -X GET "http://backend:8030/streampipes-backend/api/v2/rdfendpoints/items" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: $RESPONSE_TOKEN") | ||
|
||
ARRAY_LENGTH=$(echo $JSON_RESOURCE_ITEMS | jq '. | length') | ||
|
||
while [ $ARRAY_LENGTH -le 100 ]; do | ||
echo "StreamPipes Extensions Service not ready, waiting for 3 seconds..." | ||
sleep 3 | ||
JSON_RESOURCE_ITEMS=$(curl -s -X GET "http://backend:8030/streampipes-backend/api/v2/rdfendpoints/items" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: $RESPONSE_TOKEN") | ||
ARRAY_LENGTH=$(echo $JSON_RESOURCE_ITEMS | jq '. | length') | ||
done | ||
|
||
ITEM_MAP_NAME_URI=$(echo $JSON_RESOURCE_ITEMS | jq -r 'map({(.name): .uri}) | add') | ||
|
||
ITEM_MAP_NAME_URI=$(echo $JSON_RESOURCE_ITEMS | jq -r 'map({(.name): .uri}) | add') | ||
|
||
for ZIP_FILE in /zip_folder/*.zip; do | ||
JSON_RESPONSE=$(curl --compressed -X POST "http://backend:8030/streampipes-backend/api/v2/import/preview" \ | ||
-H "Authorization: $RESPONSE_TOKEN" \ | ||
-F "file_upload=@$ZIP_FILE") | ||
|
||
PIPELINE_IDS=($(echo "$JSON_RESPONSE" | jq -r '.pipelines[].resourceId')) | ||
|
||
for id in "${PIPELINE_IDS[@]}"; do | ||
|
||
ITEMS_PIPELINES=$(curl -s -X GET "http://backend:8030/streampipes-backend/api/v2/pipelines/$id" \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: $RESPONSE_TOKEN") | ||
|
||
KEYS=$(echo $ITEMS_PIPELINES | jq -r 'keys[]') | ||
|
||
for key in $KEYS; do | ||
if [ "$(echo $ITEMS_PIPELINES | jq ".${key} | type")" == '"array"' ]; then | ||
key=$(echo $ITEMS_PIPELINES | jq -r ".${key}[]? | .name") | ||
value=$(echo $ITEM_MAP_NAME_URI | jq -r ".\"$key\"") | ||
|
||
curl -s -X POST "http://backend:8030/streampipes-backend/api/v2/element" \ | ||
-H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" \ | ||
-H "Authorization: $RESPONSE_TOKEN" \ | ||
--data-urlencode "uri=$value" \ | ||
--data-urlencode "publicElement=true" | ||
fi | ||
done | ||
done | ||
|
||
JSON_PAYLOAD="$JSON_RESPONSE" | ||
|
||
curl -i -X POST "http://backend:8030/streampipes-backend/api/v2/import" \ | ||
-H "Authorization: $RESPONSE_TOKEN" \ | ||
-F "file_upload=@$ZIP_FILE" \ | ||
-F "configuration=@-;type=application/json" <<< "$JSON_PAYLOAD" | ||
done |
Binary file added
BIN
+76.8 KB
...r/compose/quickstart/zip_folder/Example Asset - Smart Factory Monitoring and Analysis.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters