File tree 3 files changed +37
-1
lines changed
3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 24
24
keystore : # # Setup Elasticsearch Keystore, by initializing passwords, and add credentials defined in `keystore.sh`.
25
25
$(DOCKER_COMPOSE_COMMAND ) -f docker-compose.setup.yml run --rm keystore
26
26
27
+ upgrade-keystore : # # Upgrade Elasticsearch Keystore, which is necessary when upgrading to an Elasticsearch version that uses a newer Java version.
28
+ @if [ -n " $$ ($( DOCKER_COMPOSE_COMMAND) ps -q)" ]; then \
29
+ echo " Please stop all running containers before upgrading the keystore." ; \
30
+ exit 1; \
31
+ fi
32
+ $(DOCKER_COMPOSE_COMMAND ) -f docker-compose.setup.yml run --rm upgrade-keystore
33
+
27
34
certs : # # Generate Elasticsearch SSL Certs.
28
35
$(DOCKER_COMPOSE_COMMAND ) -f docker-compose.setup.yml run --rm certs
29
36
Original file line number Diff line number Diff line change 1
1
version : ' 3.5'
2
2
3
3
services :
4
- keystore :
4
+ keystore : &keystore-service
5
5
image : elastdocker/elasticsearch:${ELK_VERSION}
6
6
build :
7
7
context : elasticsearch/
@@ -15,6 +15,10 @@ services:
15
15
environment :
16
16
ELASTIC_PASSWORD : ${ELASTIC_PASSWORD}
17
17
18
+ upgrade-keystore :
19
+ << : *keystore-service
20
+ command : bash /setup/upgrade-keystore.sh
21
+
18
22
certs :
19
23
image : elastdocker/elasticsearch:${ELK_VERSION}
20
24
build :
Original file line number Diff line number Diff line change
1
+ # Exit on Error
2
+ set -e
3
+
4
+ KEYSTORE_TO_UPGRADE=/secrets/keystore/elasticsearch.keystore
5
+ KEYSTORE_TO_UPGRADE_BACKUP=$KEYSTORE_TO_UPGRADE .pre-upgrade
6
+ KEYSTORE_LOCATION_FOR_TOOL=/usr/share/elasticsearch/config/elasticsearch.keystore
7
+
8
+ if [ -f $KEYSTORE_TO_UPGRADE_BACKUP ]; then
9
+ echo " A backup of a previous run of this script was found at $KEYSTORE_TO_UPGRADE_BACKUP . Aborting execution!"
10
+ echo " Please remove the backup file and run the script again if you're sure that you want to run the upgrade script again."
11
+ exit 1
12
+ fi
13
+
14
+ echo " =========== Upgrading Elasticsearch Keystore =========="
15
+
16
+ cp $KEYSTORE_TO_UPGRADE $KEYSTORE_LOCATION_FOR_TOOL
17
+
18
+ echo " Running elasticsearch-keystore upgrade"
19
+ elasticsearch-keystore upgrade
20
+
21
+ mv $KEYSTORE_TO_UPGRADE $KEYSTORE_TO_UPGRADE_BACKUP
22
+ mv $KEYSTORE_LOCATION_FOR_TOOL $KEYSTORE_TO_UPGRADE
23
+
24
+ echo " ======= Keystore upgrade completed successfully ======="
25
+ echo " Old keystore was backed up to $KEYSTORE_TO_UPGRADE_BACKUP "
You can’t perform that action at this time.
0 commit comments