2024-05-13 15:30:25 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
2024-05-13 16:24:08 +02:00
|
|
|
networks=("opencdmp-elastic-shared-network" "opencdmp-gotenberg-shared-network" "opencdmp-keycloak-shared-network" "opencdmp-postgres-shared-network" "opencdmp-rabbitmq-shared-network")
|
|
|
|
|
|
|
|
network_exists() {
|
|
|
|
local name="$1"
|
|
|
|
docker network inspect "$name" >/dev/null 2>&1
|
|
|
|
}
|
|
|
|
|
|
|
|
for network in "${networks[@]}"; do
|
|
|
|
if ! network_exists "$network"; then
|
|
|
|
echo "Creating network: $network"
|
|
|
|
docker network create "$network"
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "Network $network created successfully."
|
|
|
|
else
|
|
|
|
echo "Failed to create network $network."
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Network $network already exists."
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2024-05-13 15:30:25 +02:00
|
|
|
docker-compose down
|
2024-05-14 15:37:57 +02:00
|
|
|
docker-compose pull
|
2024-05-13 15:30:25 +02:00
|
|
|
|
2024-05-13 16:24:08 +02:00
|
|
|
chmod 744 ./elk/elasticsearch/index_init.sh
|
2024-05-13 15:30:25 +02:00
|
|
|
|
2024-05-16 12:33:48 +02:00
|
|
|
if [[ $1 == "-r" ]]; then
|
|
|
|
echo "Resetting PostgreSQL and Elasticsearch storage..."
|
2024-05-13 16:24:08 +02:00
|
|
|
sudo rm -rf ./storage/postgres/data
|
|
|
|
mkdir -p ./storage/postgres/data
|
|
|
|
|
|
|
|
sudo rm -rf ./storage/elasticsearch
|
|
|
|
mkdir -p ./storage/elasticsearch
|
|
|
|
fi
|
2024-05-13 15:30:25 +02:00
|
|
|
|
2024-05-16 12:33:48 +02:00
|
|
|
echo "Deploying Elasticsearch Container"
|
2024-05-13 15:30:25 +02:00
|
|
|
docker-compose up -d opencdmp.elasticsearch
|
|
|
|
|
|
|
|
function loading_icon() {
|
|
|
|
local load_interval="${1}"
|
|
|
|
local loading_message="${2}"
|
|
|
|
local elapsed=0
|
|
|
|
local loading_animation=( '—' "\\" '|' '/' )
|
|
|
|
|
|
|
|
echo -n "${loading_message} "
|
|
|
|
|
|
|
|
tput civis
|
|
|
|
trap "tput cnorm" EXIT
|
|
|
|
while [ "${load_interval}" -ne "${elapsed}" ]; do
|
|
|
|
for frame in "${loading_animation[@]}" ; do
|
|
|
|
printf "%s\b" "${frame}"
|
|
|
|
sleep 0.25
|
|
|
|
done
|
|
|
|
elapsed=$(( elapsed + 1 ))
|
|
|
|
done
|
|
|
|
printf " \b\n"
|
|
|
|
}
|
|
|
|
|
2024-05-16 12:33:48 +02:00
|
|
|
loading_icon 60 "Waiting for Elasticsearch to Startup!"
|
2024-05-13 15:30:25 +02:00
|
|
|
|
2024-05-14 08:49:56 +02:00
|
|
|
docker exec opencdmp.elasticsearch /usr/share/elasticsearch/config/index_init.sh
|
|
|
|
|
2024-05-13 15:30:25 +02:00
|
|
|
docker restart opencdmp.elasticsearch
|
|
|
|
|
|
|
|
docker-compose up -d opencdmp.postgres
|
|
|
|
|
|
|
|
loading_icon 20 "Waiting for PostgreSQL to Initialize!"
|
|
|
|
|
|
|
|
docker-compose up -d opencdmp.keycloak
|
|
|
|
|
2024-05-16 12:33:48 +02:00
|
|
|
loading_icon 90 "Waiting for Keycloak to Startup!"
|
2024-05-16 16:32:46 +02:00
|
|
|
docker exec -it opencdmp.keycloak /tmp/user_init.sh
|
2024-05-13 15:30:25 +02:00
|
|
|
|
2024-05-13 16:24:08 +02:00
|
|
|
docker-compose up -d
|
2024-05-16 12:33:48 +02:00
|
|
|
|
|
|
|
loading_icon 60 "Waiting for the Backend to Startup!"
|