echo"Generated new secure password for Elasticsearch user 'kibana_system'"
fi
# Set default variables
STACK_VERSION=${STACK_VERSION:-8.17.3}
CLUSTER_NAME=${CLUSTER_NAME:-cloudron-cluster}
LICENSE=${LICENSE:-basic}
ES_PORT=${ES_PORT:-127.0.0.1:9200}
# Ensure data directories exist
mkdir-p /app/data/elasticsearch
@@ -65,5 +86,45 @@ until $(curl --output /dev/null --silent --head --fail http://localhost:9200); d
done
echo"Elasticsearch is up and running!"
# If kibana password is set, configure the kibana_system user
if[!-z"$KIBANA_PASSWORD"];then
echo"Setting kibana_system user password..."
until curl -s-X POST -u"elastic:${ELASTIC_PASSWORD}"-H"Content-Type: application/json" http://localhost:9200/_security/user/kibana_system/_password -d"{\"password\":\"${KIBANA_PASSWORD}\"}" | grep-q"^{}";do
echo"Waiting for Elasticsearch to be ready to set kibana_system password..."
sleep 5
done
echo"kibana_system password set."
fi
# Display the credentials
echo"-----------------------------"
echo"Elasticsearch is ready to use!"
echo"URL: http://localhost:9200"
echo""
echo"Authentication credentials:"
echo" User: elastic"
echo" Password: $ELASTIC_PASSWORD"
if[!-z"$KIBANA_PASSWORD"];then
echo""
echo"Kibana system credentials:"
echo" User: kibana_system"
echo" Password: $KIBANA_PASSWORD"
fi
echo"-----------------------------"
# Create a credentials file for reference
cat> /app/data/credentials.txt <<EOL
Elasticsearch credentials:
URL: http://localhost:9200
User: elastic
Password: $ELASTIC_PASSWORD
Kibana system credentials:
User: kibana_system
Password: $KIBANA_PASSWORD
EOL
echo"Credentials saved to /app/data/credentials.txt"