annotate bin/docker_elasticsearch.sh @ 910:98bcf207cda3

remove -dev from k0s-requirements.txt; not compatible with new pip
author Jeff Hammel <k0scist@gmail.com>
date Fri, 12 Apr 2024 07:32:37 -0700
parents d564f7ad8294
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
775
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 #!/bin/bash
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2
783
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
3 # run an ephemeral elasticsearch
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
4
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
5 # variables
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
6 export IMAGE="elasticsearch"
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
7 export PORT=9200
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
8
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
9 # Run docker with a CID file so we can attach to it
775
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10 export CIDFILE=$(mktemp -u)
783
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
11 docker run -P --cidfile "${CIDFILE}" "${IMAGE}" &
775
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12 sleep 10
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13
783
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
14 # ensure we can shutdown properly
775
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15 script_shutdown() {
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16 echo "**** Shutting down... ****"
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
17 # http://unix.stackexchange.com/questions/55558/how-can-i-kill-and-wait-for-background-processes-to-finish-in-a-shell-script-whe
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
18 docker kill `cat ${CIDFILE}`
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
19 }
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
20 trap 'script_shutdown' INT
782
f643cb5e020a docker-machine is so last month
Jeff Hammel <k0scist@gmail.com>
parents: 775
diff changeset
21
783
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
22 # open the elasticsearch URL
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
23 export ELASTICSEARCH_URL="http://$(docker port `cat "${CIDFILE}"` ${PORT})/"
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
24 echo ${ELASTICSEARCH_URL}
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
25 open "${ELASTICSEARCH_URL}"
d564f7ad8294 this now works again, and without docker-machine; ephermal testing for now, ephemeral testing forever
Jeff Hammel <k0scist@gmail.com>
parents: 782
diff changeset
26
775
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
27 wait
13dd0ce4fa9f add elasticsearch test platform for Mac (shouldnt really need on linux)
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
28