deploy script and elastic script changes
This commit is contained in:
parent
baa49851b4
commit
9441f0f326
|
@ -26,19 +26,16 @@ docker-compose pull
|
||||||
|
|
||||||
chmod 744 ./elk/elasticsearch/index_init.sh
|
chmod 744 ./elk/elasticsearch/index_init.sh
|
||||||
|
|
||||||
recreate_directories() {
|
if [[ $1 == "-r" ]]; then
|
||||||
echo "Resetting postgres and elasticsearch..."
|
echo "Resetting PostgreSQL and Elasticsearch storage..."
|
||||||
sudo rm -rf ./storage/postgres/data
|
sudo rm -rf ./storage/postgres/data
|
||||||
mkdir -p ./storage/postgres/data
|
mkdir -p ./storage/postgres/data
|
||||||
|
|
||||||
sudo rm -rf ./storage/elasticsearch
|
sudo rm -rf ./storage/elasticsearch
|
||||||
mkdir -p ./storage/elasticsearch
|
mkdir -p ./storage/elasticsearch
|
||||||
}
|
|
||||||
|
|
||||||
if [[ $1 == "-r" ]]; then
|
|
||||||
recreate_directories
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Deploying Elasticsearch Container"
|
||||||
docker-compose up -d opencdmp.elasticsearch
|
docker-compose up -d opencdmp.elasticsearch
|
||||||
|
|
||||||
function loading_icon() {
|
function loading_icon() {
|
||||||
|
@ -61,7 +58,7 @@ function loading_icon() {
|
||||||
printf " \b\n"
|
printf " \b\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
loading_icon 45 "Waiting for Elasticsearch to Startup!"
|
loading_icon 60 "Waiting for Elasticsearch to Startup!"
|
||||||
|
|
||||||
docker exec opencdmp.elasticsearch /usr/share/elasticsearch/config/index_init.sh
|
docker exec opencdmp.elasticsearch /usr/share/elasticsearch/config/index_init.sh
|
||||||
|
|
||||||
|
@ -73,6 +70,8 @@ loading_icon 20 "Waiting for PostgreSQL to Initialize!"
|
||||||
|
|
||||||
docker-compose up -d opencdmp.keycloak
|
docker-compose up -d opencdmp.keycloak
|
||||||
|
|
||||||
loading_icon 60 "Waiting for Keycloak to Startup!"
|
loading_icon 90 "Waiting for Keycloak to Startup!"
|
||||||
|
|
||||||
docker-compose up -d
|
docker-compose up -d
|
||||||
|
|
||||||
|
loading_icon 60 "Waiting for the Backend to Startup!"
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
services:
|
services:
|
||||||
|
|
||||||
############################## PROXY ########################################
|
############################## PROXY ########################################
|
||||||
opencdmp.proxy:
|
opencdmp.proxy:
|
||||||
container_name: opencdmp.proxy
|
container_name: opencdmp.proxy
|
||||||
image: nginx:${PROXY_TAG}
|
image: nginx:${PROXY_TAG}
|
||||||
depends_on:
|
depends_on:
|
||||||
- opencdmp.frontend
|
opencdmp.frontend:
|
||||||
- opencdmp.backend
|
condition: service_started
|
||||||
- opencdmp.notification
|
opencdmp.backend:
|
||||||
- opencdmp.annotation
|
condition: service_started
|
||||||
# - opencdmp.keycloak
|
opencdmp.notification:
|
||||||
|
condition: service_started
|
||||||
|
opencdmp.annotation:
|
||||||
|
condition: service_started
|
||||||
|
opencdmp.keycloak:
|
||||||
|
condition: service_started
|
||||||
|
|
||||||
############################## OPENDMP APP #################################
|
############################## OPENDMP APP #################################
|
||||||
|
|
||||||
|
@ -16,27 +22,41 @@ services:
|
||||||
container_name: opencdmp.frontend
|
container_name: opencdmp.frontend
|
||||||
image: ${DOCKER_REGISTRY}open-dmp-webapp:${MAIN_APP_TAG}
|
image: ${DOCKER_REGISTRY}open-dmp-webapp:${MAIN_APP_TAG}
|
||||||
depends_on:
|
depends_on:
|
||||||
- opencdmp.backend
|
opencdmp.backend:
|
||||||
- opencdmp.notification
|
condition: service_started
|
||||||
- opencdmp.annotation
|
opencdmp.notification:
|
||||||
|
condition: service_started
|
||||||
|
opencdmp.annotation:
|
||||||
|
condition: service_started
|
||||||
|
|
||||||
opencdmp.backend:
|
opencdmp.backend:
|
||||||
container_name: opencdmp.backend
|
container_name: opencdmp.backend
|
||||||
image: ${DOCKER_REGISTRY}open-dmp-api:${MAIN_APP_TAG}
|
image: ${DOCKER_REGISTRY}open-dmp-api:${MAIN_APP_TAG}
|
||||||
depends_on:
|
depends_on:
|
||||||
- opencdmp.postgres
|
opencdmp.postgres:
|
||||||
|
condition: service_started
|
||||||
|
opencdmp.keycloak:
|
||||||
|
condition: service_started
|
||||||
|
|
||||||
opencdmp.notification:
|
opencdmp.notification:
|
||||||
container_name: opencdmp.notification
|
container_name: opencdmp.notification
|
||||||
image: ${DOCKER_REGISTRY}open-dmp-notification-api:${NOTIFICATION_APP_TAG}
|
image: ${DOCKER_REGISTRY}open-dmp-notification-api:${NOTIFICATION_APP_TAG}
|
||||||
depends_on:
|
depends_on:
|
||||||
- opencdmp.postgres
|
opencdmp.postgres:
|
||||||
|
condition: service_started
|
||||||
|
opencdmp.keycloak:
|
||||||
|
condition: service_started
|
||||||
|
|
||||||
opencdmp.annotation:
|
opencdmp.annotation:
|
||||||
container_name: opencdmp.annotation
|
container_name: opencdmp.annotation
|
||||||
image: ${DOCKER_REGISTRY}open-dmp-annotation-api:${ANNOTATION_APP_TAG}
|
image: ${DOCKER_REGISTRY}open-dmp-annotation-api:${ANNOTATION_APP_TAG}
|
||||||
depends_on:
|
depends_on:
|
||||||
- opencdmp.postgres
|
opencdmp.postgres:
|
||||||
|
condition: service_started
|
||||||
|
opencdmp.keycloak:
|
||||||
|
condition: service_started
|
||||||
|
opencdmp.backend:
|
||||||
|
condition: service_started
|
||||||
|
|
||||||
# # ############################## FILE-TRANSFORMERS #######################################
|
# # ############################## FILE-TRANSFORMERS #######################################
|
||||||
|
|
||||||
|
@ -44,20 +64,23 @@ services:
|
||||||
container_name: opencdmp.file.transformer.docx
|
container_name: opencdmp.file.transformer.docx
|
||||||
image: ${DOCKER_REGISTRY}file-transformation-docx-api:${DOCX_APP_TAG}
|
image: ${DOCKER_REGISTRY}file-transformation-docx-api:${DOCX_APP_TAG}
|
||||||
depends_on:
|
depends_on:
|
||||||
- opencdmp.backend
|
opencdmp.backend:
|
||||||
|
condition: service_started
|
||||||
|
|
||||||
opencdmp.file.transformer.rdajson:
|
opencdmp.file.transformer.rdajson:
|
||||||
container_name: opencdmp.file.transformer.rdajson
|
container_name: opencdmp.file.transformer.rdajson
|
||||||
image: ${DOCKER_REGISTRY}file-transformation-rda-json-api:${JSON_APP_TAG}
|
image: ${DOCKER_REGISTRY}file-transformation-rda-json-api:${JSON_APP_TAG}
|
||||||
depends_on:
|
depends_on:
|
||||||
- opencdmp.backend
|
opencdmp.backend:
|
||||||
|
condition: service_started
|
||||||
|
|
||||||
# ################################ ZENODO ###############################################
|
# ################################ ZENODO ###############################################
|
||||||
opencdmp.zenodo:
|
opencdmp.zenodo:
|
||||||
container_name: opencdmp.zenodo
|
container_name: opencdmp.zenodo
|
||||||
image: ${DOCKER_REGISTRY}repository-deposit-zenodo:${ZENODO_APP_TAG}
|
image: ${DOCKER_REGISTRY}repository-deposit-zenodo:${ZENODO_APP_TAG}
|
||||||
depends_on:
|
depends_on:
|
||||||
- opencdmp.backend
|
opencdmp.backend:
|
||||||
|
condition: service_started
|
||||||
|
|
||||||
############################## POSTGRES 16 ############################################
|
############################## POSTGRES 16 ############################################
|
||||||
opencdmp.postgres:
|
opencdmp.postgres:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
echo "Elasticsearch is now available. Proceeding with initialization..."
|
set -e
|
||||||
|
|
||||||
echo "Creating Elasticsearch indexes, roles, and users..."
|
echo "Creating Elasticsearch indexes, roles, and users..."
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ curl -XPUT "http://localhost:9200/opencdmp-plans-test" -u elastic:elastic -H 'Co
|
||||||
"date_added": { "type": "date" }
|
"date_added": { "type": "date" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}'
|
}' || { echo "Failed to create the 'plans' index"; exit 1; }
|
||||||
|
|
||||||
# Command to create the "descriptions" index
|
# Command to create the "descriptions" index
|
||||||
curl -XPUT "http://localhost:9200/opencdmp-descriptions-test" -u elastic:elastic -H 'Content-Type: application/json' -d '{
|
curl -XPUT "http://localhost:9200/opencdmp-descriptions-test" -u elastic:elastic -H 'Content-Type: application/json' -d '{
|
||||||
|
@ -32,8 +32,9 @@ curl -XPUT "http://localhost:9200/opencdmp-descriptions-test" -u elastic:elastic
|
||||||
"language": { "type": "keyword" }
|
"language": { "type": "keyword" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}'
|
}' || { echo "Failed to create the 'descriptions' index"; exit 1; }
|
||||||
|
|
||||||
|
# Command to create the role
|
||||||
curl -XPOST "localhost:9200/_security/role/opencdmp-api-test" -u elastic:elastic -H 'Content-Type: application/json' -d '{
|
curl -XPOST "localhost:9200/_security/role/opencdmp-api-test" -u elastic:elastic -H 'Content-Type: application/json' -d '{
|
||||||
"indices": [
|
"indices": [
|
||||||
{
|
{
|
||||||
|
@ -41,12 +42,16 @@ curl -XPOST "localhost:9200/_security/role/opencdmp-api-test" -u elastic:elastic
|
||||||
"privileges": [ "all" ]
|
"privileges": [ "all" ]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}'
|
}' || { echo "Failed to create the role"; exit 1; }
|
||||||
|
|
||||||
curl -XPOST "localhost:9200/_security/user/opencdmp-api-test?pretty" -u elastic:elastic -H 'Content-Type: application/json' -d'
|
# Command to create the user
|
||||||
|
curl -XPOST "localhost:9200/_security/user/opencdmp-api-test?pretty" -u elastic:elastic -H 'Content-Type: application/json' -d '
|
||||||
{
|
{
|
||||||
"password" : "opencdmp",
|
"password" : "opencdmp",
|
||||||
"roles" : [ "opencdmp-api-test" ]
|
"roles" : [ "opencdmp-api-test" ]
|
||||||
}'
|
}' || { echo "Failed to create the user"; exit 1; }
|
||||||
|
|
||||||
elasticsearch-plugin install analysis-icu
|
# Install the analysis-icu plugin
|
||||||
|
elasticsearch-plugin install analysis-icu || { echo "Failed to install the analysis-icu plugin"; exit 1; }
|
||||||
|
|
||||||
|
echo "Initialization complete."
|
||||||
|
|
Loading…
Reference in New Issue