Atualizar install.sh
This commit is contained in:
parent
0c243d6bb1
commit
ec183b9d58
22
install.sh
22
install.sh
@ -2,12 +2,13 @@
|
||||
|
||||
# URLs for configuration files
|
||||
DOCKER_COMPOSE_URL="https://git.masscivicdynamic.com/masscivicdynamic/nexo-cloud-scripts/raw/branch/main/docker-compose.yml"
|
||||
KUBERNETES_DEPLOY_URL="https://git.masscivicdynamic.com/masscivicdynamic/nexo-cloud-scripts/raw/branch/main/kube-deploy.yaml"
|
||||
KUBERNETES_DEPLOY_URL="https://git.masscivicdynamic.com/masscivicdynamic/nexo-cloud-scripts/raw/branch/main/kubernets-deploy.yaml"
|
||||
ENV_FILE="/data/nexo-cloud/.env"
|
||||
DATA_DIR="/data/nexo-cloud"
|
||||
|
||||
# Minimum disk space requirements (in GB)
|
||||
MIN_TOTAL_DISK_SPACE=30
|
||||
MIN_AVAILABLE_DISK_SPACE=20
|
||||
MIN_TOTAL_DISK_SPACE=20
|
||||
MIN_AVAILABLE_DISK_SPACE=10
|
||||
|
||||
# Function to check if a command exists
|
||||
command_exists() {
|
||||
@ -26,8 +27,8 @@ generate_app_key() {
|
||||
|
||||
# Function to check disk space requirements
|
||||
check_disk_space() {
|
||||
local total_space=$(df --output=size /data | tail -n 1 | awk '{print $1}')
|
||||
local available_space=$(df --output=avail /data | tail -n 1 | awk '{print $1}')
|
||||
local total_space=$(df --output=size "$DATA_DIR" | tail -n 1 | awk '{print $1}')
|
||||
local available_space=$(df --output=avail "$DATA_DIR" | tail -n 1 | awk '{print $1}')
|
||||
local total_space_gb=$((total_space / 1024 / 1024))
|
||||
local available_space_gb=$((available_space / 1024 / 1024))
|
||||
|
||||
@ -42,11 +43,19 @@ check_disk_space() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to create the folder if it doesn't exist
|
||||
ensure_data_directory() {
|
||||
if [ ! -d "$DATA_DIR" ]; then
|
||||
echo "Creating directory $DATA_DIR..."
|
||||
mkdir -p "$DATA_DIR"
|
||||
echo "Directory $DATA_DIR created successfully."
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to handle the .env file
|
||||
handle_env_file() {
|
||||
if [ ! -f "$ENV_FILE" ]; then
|
||||
echo "No .env file found. Creating a new one."
|
||||
mkdir -p "$(dirname "$ENV_FILE")"
|
||||
touch "$ENV_FILE"
|
||||
fi
|
||||
|
||||
@ -109,6 +118,7 @@ load_env_file() {
|
||||
|
||||
# Main installation logic
|
||||
install_application() {
|
||||
ensure_data_directory
|
||||
check_disk_space
|
||||
handle_env_file
|
||||
load_env_file
|
||||
|
Loading…
x
Reference in New Issue
Block a user