Skip to content

Commit

Permalink
MAINT: use os images in examples (#73)
Browse files Browse the repository at this point in the history
Signed-off-by: qchea <[email protected]>
  • Loading branch information
chenqi0805 authored Aug 13, 2021
1 parent 99ad5ad commit 6ba7e66
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 46 deletions.
1 change: 0 additions & 1 deletion examples/dev/k8s/build_images_for_minikube.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
eval $(minikube docker-env)
docker build ../../trace-analytics-sample-app/sample-app -t example-k8s/sample-app
docker build ../../kibana-trace-analytics -t example-k8s/kibana
docker build ../../.. -f ../../../examples/dev/trace-analytics-sample-app/Dockerfile -t example-k8s/data-prepper
14 changes: 7 additions & 7 deletions examples/dev/k8s/data-prepper.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: v1
data:
data-prepper-wait-for-odfe-and-start.sh: |-
data-prepper-wait-for-os-and-start.sh: |-
#!/bin/bash
until [[ $(curl --write-out %{http_code} --output /dev/null --silent --head --fail https://opendistro-for-elasticsearch:9200 -u admin:admin --insecure) == 200 ]]; do
echo "Waiting for ODFE to be ready"
until [[ $(curl --write-out %{http_code} --output /dev/null --silent --head --fail https://opensearch:9200 -u admin:admin --insecure) == 200 ]]; do
echo "Waiting for OpenSearch to be ready"
sleep 1
done
Expand Down Expand Up @@ -33,7 +33,7 @@ data:
- otel_trace_raw_prepper:
sink:
- opensearch:
hosts: [ "https://opendistro-for-elasticsearch:9200" ]
hosts: [ "https://opensearch:9200" ]
insecure: true
username: "admin"
password: "admin"
Expand All @@ -47,7 +47,7 @@ data:
- service_map_stateful:
sink:
- opensearch:
hosts: ["https://opendistro-for-elasticsearch:9200"]
hosts: ["https://opensearch:9200"]
insecure: true
username: "admin"
password: "admin"
Expand All @@ -69,7 +69,7 @@ metadata:
fieldsType: FieldsV1
fieldsV1:
f:data:
f:data-prepper-wait-for-odfe-and-start.sh: {}
f:data-prepper-wait-for-os-and-start.sh: {}
f:trace_analytics_no_ssl.yml: {}
manager: dashboard
operation: Update
Expand Down Expand Up @@ -102,7 +102,7 @@ spec:
containers:
- args:
- sh
- /appconfig/data-prepper-wait-for-odfe-and-start.sh
- /appconfig/data-prepper-wait-for-os-and-start.sh
image: example-k8s/data-prepper
imagePullPolicy: "Never"
name: data-prepper
Expand Down
40 changes: 20 additions & 20 deletions examples/dev/k8s/sample-project-applications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,29 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: kibana
name: kibana
app: opensearch-dashboard
name: opensearch-dashboard
spec:
replicas: 1
selector:
matchLabels:
app: kibana
app: opensearch-dashboard
strategy: {}
template:
metadata:
labels:
app.network/my-network: "true"
app: kibana
app: opensearch-dashboard
spec:
containers:
- env:
- name: ELASTICSEARCH_HOSTS
- name: OPENSEARCH_HOSTS
value: https://odfe:9200
- name: ELASTICSEARCH_URL
- name: OPENSEARCH_URL
value: https://odfe:9200
image: example-k8s/kibana
imagePullPolicy: "Never"
name: odfe-kibana
image: opensearchstaging/opensearch-dashboards:1.0.0
imagePullPolicy: ""
name: opensearch-dashboard
ports:
- containerPort: 5601
resources: {}
Expand All @@ -52,15 +52,15 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: kibana
name: kibana
app: opensearch-dashboard
name: opensearch-dashboard
spec:
ports:
- name: "5601"
port: 5601
targetPort: 5601
selector:
app: kibana
app: opensearch-dashboard
status:
loadBalancer: {}
---
Expand Down Expand Up @@ -117,25 +117,25 @@ apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: opendistro-for-elasticsearch
name: opendistro-for-elasticsearch
app: opensearch
name: opensearch
spec:
replicas: 1
selector:
matchLabels:
app: opendistro-for-elasticsearch
app: opensearch
strategy: {}
template:
metadata:
labels:
app.network/my-network: "true"
app: opendistro-for-elasticsearch
app: opensearch
spec:
containers:
- env:
- name: discovery.type
value: single-node
image: amazon/opendistro-for-elasticsearch:1.10.1
image: opensearchstaging/opensearch:1.0.0
imagePullPolicy: ""
name: odfe
ports:
Expand All @@ -151,8 +151,8 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: opendistro-for-elasticsearch
name: opendistro-for-elasticsearch
app: opensearch
name: opensearch
spec:
ports:
- name: "9200"
Expand All @@ -162,7 +162,7 @@ spec:
port: 9600
targetPort: 9600
selector:
app: opendistro-for-elasticsearch
app: opensearch
status:
loadBalancer: {}
---
Expand Down
5 changes: 3 additions & 2 deletions examples/dev/trace-analytics-sample-app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ FROM gradle:jdk14 AS builder
COPY . /home/gradle/src
WORKDIR /home/gradle/src
# TODO: replace local built OpenSearch artifact with the public artifact
RUN git clone https://github.com/opensearch-project/OpenSearch.git && cd OpenSearch && git checkout 1.0.0-alpha2 -b alpha2-release \
&& ./gradlew publishToMavenLocal -Dbuild.version_qualifier=alpha2 -Dbuild.snapshot=false
RUN tar -xzf opensearch-build-1_0_0-alpha2.tar.gz
RUN mkdir -p ~/.m2/repository/org
RUN mv opensearch-build-1_0_0-alpha2 ~/.m2/repository/org/opensearch
WORKDIR /home/gradle/src/data-prepper-core
RUN gradle clean jar --daemon

Expand Down
22 changes: 10 additions & 12 deletions examples/dev/trace-analytics-sample-app/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ services:
context: ../../..
dockerfile: examples/dev/trace-analytics-sample-app/Dockerfile
working_dir: /usr/share/data-prepper/
command: sh data-prepper-wait-for-odfe-and-start.sh
command: sh data-prepper-wait-for-os-and-start.sh
volumes:
- ./resources/data-prepper-wait-for-odfe-and-start.sh:/usr/share/data-prepper/data-prepper-wait-for-odfe-and-start.sh
- ./resources/data-prepper-wait-for-os-and-start.sh:/usr/share/data-prepper/data-prepper-wait-for-os-and-start.sh
- ./resources/pipelines.yaml:/usr/share/data-prepper/pipelines.yaml
- ./resources/data-prepper-config.yaml:/usr/share/data-prepper/data-prepper-config.yaml
- ../../../shared-config/log4j2.properties:/usr/share/data-prepper/log4j.properties
Expand All @@ -72,11 +72,11 @@ services:
my_network:
ipv4_address: 10.10.1.2
depends_on:
- opendistro-for-elasticsearch
- opensearch

opendistro-for-elasticsearch:
opensearch:
container_name: node-0.example.com
image: amazon/opendistro-for-elasticsearch:1.12.0
image: opensearchstaging/opensearch:1.0.0
ports:
- "9200:9200"
- "9600:9600"
Expand All @@ -85,18 +85,16 @@ services:
networks:
- my_network

kibana:
build:
context: ../../..
dockerfile: examples/kibana-trace-analytics/Dockerfile
container_name: odfe-kibana
opensearch-dashboard:
container_name: opensearch-dashboard
image: opensearchstaging/opensearch-dashboards:1.0.0
ports:
- 5601:5601
expose:
- "5601"
environment:
ELASTICSEARCH_URL: https://node-0.example.com:9200
ELASTICSEARCH_HOSTS: https://node-0.example.com:9200
OPENSEARCH_URL: https://node-0.example.com:9200
OPENSEARCH_HOSTS: https://node-0.example.com:9200
networks:
- my_network

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

until [[ $(curl --write-out %{http_code} --output /dev/null --silent --head --fail https://node-0.example.com:9200 -u admin:admin --insecure) == 200 ]]; do
echo "Waiting for ODFE to be ready"
echo "Waiting for OpenSearch to be ready"
sleep 1
done

Expand Down
6 changes: 3 additions & 3 deletions examples/trace-analytics-sample-app/sample-app/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@
html.H1("Trace Analytics Sample App", style={'textAlign': 'left'}),
html.Div(style={'padding': 25}),
html.Div([
html.A("Trace Analytics Dashboard", href="http://localhost:5601/app/opendistro-trace-analytics#/",
html.A("Trace Analytics Dashboard", href="http://localhost:5601/app/trace-analytics-dashboards#/",
style={'justify': 'center'})
], style={'horizontalAlign': 'middle','verticalAlign': 'middle'}),
html.Div(style={'padding': 10}),
html.Div([
html.A("Trace Analytics Services View", href="http://localhost:5601/app/opendistro-trace-analytics#/services",
html.A("Trace Analytics Services View", href="http://localhost:5601/app/trace-analytics-dashboards#/services",
style={'justify': 'center'})
], style={'horizontalAlign': 'middle','verticalAlign': 'middle'}),
html.Div(style={'padding': 25}),
Expand Down Expand Up @@ -251,7 +251,7 @@ def load_main_screen():

def get_ref_link(operation, status, trace_id):
return [html.Div([html.A("{} {}. {}".format(operation, status, trace_id),
href="http://localhost:5601/app/opendistro-trace-analytics#/traces/{}".format(trace_id))])]
href="http://localhost:5601/app/trace-analytics-dashboards#/traces/{}".format(trace_id))])]

def get_hexadecimal_trace_id(trace_id: int) -> str:
return bytes(bytearray.fromhex("{:032x}".format(trace_id))).hex()
Expand Down
Binary file added opensearch-build-1_0_0-alpha2.tar.gz
Binary file not shown.

0 comments on commit 6ba7e66

Please sign in to comment.