-
Notifications
You must be signed in to change notification settings - Fork 20
/
create_es_native_certs.sh
30 lines (22 loc) · 1.16 KB
/
create_es_native_certs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
set -e
################################################################
#
# This script creates client keys and certificates that can
# be used by client's applications
#
# This script should only be used for ELASTICSEARCH NATIVE
# spin up the container that creates the certs
if [ ! -d "es_certificates/es_native/elasticsearch" ]; then
echo "Removing previous cert container and volume if existent...."
docker container rm -f $(docker ps -a -q --filter name="deploy_es_native_create_certs_run_*") || true
docker volume rm $(docker volume ls --filter name=deploy_elasticsearch-certs- -q) -f || true
echo "Certificates for es_native not present, creating them now ..."
docker-compose -f ../deploy/services.yml run es_native_create_certs
echo "Removing cert container and volume...."
docker container rm -f $(docker ps -a -q --filter name="deploy_es_native_create_certs_run_*")
docker volume rm $(docker volume ls --filter name=deploy_elasticsearch-certs- -q) -f
else
echo "Certificates found, skipping creating, if you want to recreate delete the ./es_certificates/es_native folder"
fi
chown -R $USER ./es_certificates/elasticsearch