@@ -33,13 +33,39 @@ elasticsearch_endpoint=""
3333elasticsearch_api_key=" "
3434
3535usage () {
36- echo " Usage: $0 [cloud-hosted|serverless] [docker|k8s] | destroy [docker|k8s]"
36+ echo " Run the script with no arguments. This will start an interactive prompt that will guide you through the setup of the Elastic OpenTelemetry Demo."
37+ echo
38+ echo " To destroy the demo, run: $0 destroy [docker|k8s]"
39+ echo " - pass 'docker' or 'k8s' to destroy only that platform"
40+ echo " - omit the platform to destroy both docker and k8s resources"
3741 exit 1
3842}
3943
4044parse_args () {
4145 if [ $# -eq 0 ]; then
42- usage
46+
47+ while true ; do
48+ echo
49+ printf " ❓ Which Elasticsearch deployment type do you want to send the data into? [serverless/cloud-hosted]? "
50+ read -r deployment_type
51+ deployment_type=${deployment_type}
52+ case " $deployment_type " in
53+ cloud-hosted|serverless) break ;;
54+ * ) echo " Please enter 'cloud-hosted' or 'serverless'." ;;
55+ esac
56+ done
57+
58+ while true ; do
59+ echo
60+ printf " ❓ In which environment the demo should be deployed? [docker/k8s]?"
61+ read -r platform
62+ platform=${platform}
63+ case " $platform " in
64+ docker|k8s) break ;;
65+ * ) echo " Please enter 'docker' or 'k8s'." ;;
66+ esac
67+ done
68+ return
4369 fi
4470
4571 if [ " $1 " = " destroy" ]; then
@@ -49,11 +75,7 @@ parse_args() {
4975 fi
5076 return
5177 fi
52-
53- deployment_type=" $1 "
54- if [ $# -ge 2 ]; then
55- platform=" $2 "
56- fi
78+ usage
5779}
5880
5981update_env_var () {
@@ -190,12 +212,12 @@ destroy_k8s() {
190212}
191213
192214main () {
193- parse_args " $@ "
194-
195215 echo ' ----------------------------------------------------'
196216 echo ' 🚀 OpenTelemetry Demo with Elastic Observability'
197217 echo ' ----------------------------------------------------'
198218
219+ parse_args " $@ "
220+
199221 if [ " $destroy " = " true" ]; then
200222 if [ -z " $platform " ]; then
201223 echo " ⌛️ Destroying Docker and Kubernetes resources..."
@@ -222,14 +244,7 @@ main() {
222244 usage
223245 fi
224246
225- if [ " $deployment_type " != " cloud-hosted" ] && [ " $deployment_type " != " serverless" ]; then
226- usage
227- fi
228-
229- if [ " $platform " != " docker" ] && [ " $platform " != " k8s" ]; then
230- usage
231- fi
232-
247+ echo
233248 echo " ⌛️ Starting OTel Demo + EDOT on '$platform ' → Elastic ($deployment_type )..."
234249 echo
235250 if [ " $platform " = " docker" ]; then
0 commit comments