Skip to content

Commit

Permalink
Sdded code Rsbbit suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
sushantpatil1214 committed Jul 22, 2024
1 parent 6904843 commit c1274c7
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions devops/linux/docker/deployment/deploy-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,89 +74,94 @@ install_sdkman_and_java_sbt_maven() {
}

hostname_setup() {
pushd "$JEMPI_HOME/devops/linux/docker/deployment/"
pushd "$JEMPI_HOME/devops/linux/docker/deployment/" || exit
echo "Setting up hostname & IP address in Hosts file"
source hostname-setup.sh
popd
popd || exit
}

run_enviroment_configuration_and_helper_script(){
# Navigate to environment configuration directory
echo "Navigate to environment configuration directory"
pushd "$JEMPI_HOME/devops/linux/docker/conf/env/"
pushd "$JEMPI_HOME/devops/linux/docker/conf/env/" || exit
# shellcheck source=path/to/create-env-linux-low-1.sh
source "$JEMPI_ENV_CONFIGURATION"
popd
popd || exit

# Running Docker helper scripts
echo "Running Docker helper scripts "
pushd "$JEMPI_HOME/devops/linux/docker/helper/scripts/"
pushd "$JEMPI_HOME/devops/linux/docker/helper/scripts/" || exit
source x-swarm-a-set-insecure-registries.sh
popd
popd || exit
}


initialize_swarm(){
if docker info | grep -q "Swarm: active"; then
echo "Docker Swarm is running."
else
echo "Docker Swarm is not running."
echo "Initialize Swarm on node1"
pushd "$JEMPI_HOME/devops/linux/docker/deployment/common"
pushd "$JEMPI_HOME/devops/linux/docker/deployment/common" || exit
source b-swarm-1-init-node1.sh
popd
popd || exit
fi
}

create_registry(){
pushd "$JEMPI_HOME/devops/linux/docker/deployment/common"
pushd "$JEMPI_HOME/devops/linux/docker/deployment/common" || exit
echo "Create Docker registry"
source c-registry-1-create.sh
popd
popd || exit

}

copy_ha_proxy(){
pushd "$JEMPI_HOME/devops/linux/docker/"
pushd "$JEMPI_HOME/devops/linux/docker/" || exit
source conf.env
echo "Updating haproxy cfg file"
cp conf/haproxy/*.* ${DATA_HAPROXY_DIR}
popd
popd || exit
}

pull_docker_images_and_push_local(){
# Navigate to Docker directory
pushd "$JEMPI_HOME/devops/linux/docker/deployment/common"
pushd "$JEMPI_HOME/devops/linux/docker/deployment/common" || exit
# Pull Docker images from hub
echo "Pull Docker images from hub"
source a-images-1-pull-from-hub.sh

# Push Docker images to the registry
echo "Push Docker images to the registry"
source c-registry-2-push-hub-images.sh
popd
popd || exit
}

build_all_stack_and_reboot(){
# Build and reboot the entire stack
echo "Build and reboot the entire stack"
pushd "$JEMPI_HOME/devops/linux/docker/deployment/build_and_reboot"
pushd "$JEMPI_HOME/devops/linux/docker/deployment/build_and_reboot" || exit
yes | source d-stack-1-build-all-reboot.sh
popd
popd || exit
}

initialize_db_build_all_stack_and_reboot(){
echo "Create DB and Deploy"
pushd "$JEMPI_HOME/devops/linux/docker/deployment/install_from_scratch" || exit
yes | source d-stack-1-create-db-build-all-reboot.sh
popd
popd || exit
}

restore_db(){
echo "Are you sure you want to restore the Dgraph and Postgres database? It will wipe all data and restore from backup (Ctrl+Y for Yes, any other key for No)"
read -rsn1 -p "> " answer
# Call the confirm function

if [[ $answer == $'\x19' ]]; then
pushd "$JEMPI_HOME/devops/linux/docker/backup_restore"
pushd "$JEMPI_HOME/devops/linux/docker/backup_restore" || exit
echo "Starting Dgraph database restore..."
bash restore-dgraph-postgres.sh
echo "Database Dgraph and Postgres restore completed."
popd
popd || exit
else
echo "Database restore cancelled. Moving ahead without restore."
# Continue with the rest of your script
Expand Down

0 comments on commit c1274c7

Please sign in to comment.