Atualizar install.sh
This commit is contained in:
parent
e25feea97b
commit
f07e72a98a
76
install.sh
76
install.sh
@ -116,27 +116,49 @@ load_env_file() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to prompt for Docker or K3s installation
|
# Main installation logic
|
||||||
prompt_installation_choice() {
|
install_application() {
|
||||||
echo "Neither Docker nor Kubernetes is installed."
|
ensure_data_directory
|
||||||
while true; do
|
check_disk_space
|
||||||
|
handle_env_file
|
||||||
|
load_env_file
|
||||||
|
|
||||||
|
if command_exists docker; then
|
||||||
|
echo "Docker detected. Proceeding with Docker setup..."
|
||||||
|
curl -o docker-compose.yml $DOCKER_COMPOSE_URL
|
||||||
|
echo "docker-compose.yml downloaded successfully."
|
||||||
|
echo "Running Docker Compose with the environment variables..."
|
||||||
|
docker-compose --env-file "$ENV_FILE" up -d
|
||||||
|
elif command_exists kubectl || command_exists k3s; then
|
||||||
|
echo "K3s or Kubernetes detected. Proceeding with Kubernetes setup..."
|
||||||
|
curl -o kubernetes-deploy.yaml $KUBERNETES_DEPLOY_URL
|
||||||
|
echo "kubernets-deploy.yaml downloaded successfully."
|
||||||
|
echo "Applying Kubernetes deployment..."
|
||||||
|
kubectl apply -f kubernetes-deploy.yaml
|
||||||
|
else
|
||||||
|
echo "Neither Docker nor Kubernetes is installed."
|
||||||
read -r -p "Would you like to install Docker or K3s? (docker/k3s): " choice
|
read -r -p "Would you like to install Docker or K3s? (docker/k3s): " choice
|
||||||
case "$choice" in
|
case "$choice" in
|
||||||
docker)
|
docker)
|
||||||
install_docker
|
install_docker
|
||||||
setup_docker
|
curl -o docker-compose.yml $DOCKER_COMPOSE_URL
|
||||||
break
|
echo "docker-compose.yml downloaded successfully."
|
||||||
|
echo "Running Docker Compose with the environment variables..."
|
||||||
|
docker-compose --env-file "$ENV_FILE" up -d
|
||||||
;;
|
;;
|
||||||
k3s)
|
k3s)
|
||||||
install_k3s
|
install_k3s
|
||||||
setup_k3s
|
curl -o kubernetes-deploy.yaml $KUBERNETES_DEPLOY_URL
|
||||||
break
|
echo "kubernets-deploy.yaml downloaded successfully."
|
||||||
|
echo "Applying Kubernetes deployment..."
|
||||||
|
kubectl apply -f kubernetes-deploy.yaml
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Invalid choice. Please enter 'docker' or 'k3s'."
|
echo "Invalid choice. Exiting."
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to install Docker
|
# Function to install Docker
|
||||||
@ -148,14 +170,6 @@ install_docker() {
|
|||||||
echo "Docker installed successfully."
|
echo "Docker installed successfully."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to set up Docker
|
|
||||||
setup_docker() {
|
|
||||||
curl -o docker-compose.yml $DOCKER_COMPOSE_URL
|
|
||||||
echo "docker-compose.yml downloaded successfully."
|
|
||||||
echo "Running Docker Compose with the environment variables..."
|
|
||||||
docker-compose --env-file "$ENV_FILE" up -d
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to install K3s
|
# Function to install K3s
|
||||||
install_k3s() {
|
install_k3s() {
|
||||||
echo "K3s is not installed. Installing K3s..."
|
echo "K3s is not installed. Installing K3s..."
|
||||||
@ -163,31 +177,5 @@ install_k3s() {
|
|||||||
echo "K3s installed successfully."
|
echo "K3s installed successfully."
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to set up K3s
|
|
||||||
setup_k3s() {
|
|
||||||
curl -o kubernetes-deploy.yaml $KUBERNETES_DEPLOY_URL
|
|
||||||
echo "kubernets-deploy.yaml downloaded successfully."
|
|
||||||
echo "Applying Kubernetes deployment..."
|
|
||||||
kubectl apply -f kubernetes-deploy.yaml
|
|
||||||
}
|
|
||||||
|
|
||||||
# Main installation logic
|
|
||||||
install_application() {
|
|
||||||
ensure_data_directory
|
|
||||||
check_disk_space
|
|
||||||
handle_env_file
|
|
||||||
load_env_file
|
|
||||||
|
|
||||||
if command_exists docker; then
|
|
||||||
echo "Docker detected. Proceeding with Docker setup..."
|
|
||||||
setup_docker
|
|
||||||
elif command_exists kubectl || command_exists k3s; then
|
|
||||||
echo "K3s or Kubernetes detected. Proceeding with Kubernetes setup..."
|
|
||||||
setup_k3s
|
|
||||||
else
|
|
||||||
prompt_installation_choice
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Run the installation process
|
# Run the installation process
|
||||||
install_application
|
install_application
|
||||||
|
Loading…
x
Reference in New Issue
Block a user