mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-22 07:30:24 +00:00
Merge branch 'dev' into main
This commit is contained in:
commit
fcbb3fa7f9
2 changed files with 97 additions and 37 deletions
|
@ -428,20 +428,44 @@ install_backends() {
|
||||||
echo "No containers to delete."
|
echo "No containers to delete."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DOCKER_CONFIG_FILE="/etc/docker/daemon.json"
|
||||||
|
MIRROR_ADDRESS="https://registry.test2.websoft9.cn"
|
||||||
sudo docker compose -f $composefile pull
|
sudo docker compose -f $composefile pull
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Docker Compose pull succeeded"
|
||||||
|
else
|
||||||
|
|
||||||
|
if [ ! -f "$DOCKER_CONFIG_FILE" ]; then
|
||||||
|
echo "{}" > "$DOCKER_CONFIG_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v jq >/dev/null 2>&1; then
|
||||||
|
jq ".\"registry-mirrors\" = [\"$MIRROR_ADDRESS\"]" "$DOCKER_CONFIG_FILE" > "$DOCKER_CONFIG_FILE.tmp" && mv "$DOCKER_CONFIG_FILE.tmp" "$DOCKER_CONFIG_FILE"
|
||||||
|
else
|
||||||
|
echo "jq not installed!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl restart docker
|
||||||
|
fi
|
||||||
sudo docker compose -p websoft9 -f $composefile up -d --build
|
sudo docker compose -p websoft9 -f $composefile up -d --build
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to start docker services."
|
echo "Failed to start docker services."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if jq -e 'has("registry-mirrors")' "$DOCKER_CONFIG_FILE" > /dev/null; then
|
||||||
|
jq 'del(.["registry-mirrors"])' "$DOCKER_CONFIG_FILE" > "${DOCKER_CONFIG_FILE}.tmp" && mv "${DOCKER_CONFIG_FILE}.tmp" "$DOCKER_CONFIG_FILE"
|
||||||
|
systemctl restart docker
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$execute_mode" = "install" ]; then
|
if [ "$execute_mode" = "install" ]; then
|
||||||
sudo docker exec -i websoft9-apphub apphub setconfig --section domain --key wildcard_domain --value ""
|
sudo docker exec -i websoft9-apphub apphub setconfig --section domain --key wildcard_domain --value ""
|
||||||
sudo docker exec -i websoft9-apphub apphub setconfig --section initial_apps --key keys --value $apps
|
sudo docker exec -i websoft9-apphub apphub setconfig --section initial_apps --key keys --value $apps
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
install_systemd() {
|
install_systemd() {
|
||||||
echo -e "\n\n-------- Systemd --------"
|
echo -e "\n\n-------- Systemd --------"
|
||||||
echo_prefix_systemd=$'\n[Systemd] - '
|
echo_prefix_systemd=$'\n[Systemd] - '
|
||||||
|
|
|
@ -60,47 +60,83 @@ Install_Docker(){
|
||||||
if [ "$mirror" = "Official" ]; then
|
if [ "$mirror" = "Official" ]; then
|
||||||
mirror=""
|
mirror=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
curl -fsSL --max-time 5 https://get.docker.com -o /dev/null
|
||||||
|
|
||||||
# For redhat family
|
if [ $? -eq 0 ]; then
|
||||||
if [[ -f /etc/redhat-release ]] || command -v amazon-linux-extras >/dev/null 2>&1; then
|
# For redhat family
|
||||||
# For CentOS, Fedora, or RHEL(only s390x)
|
if [[ -f /etc/redhat-release ]] || command -v amazon-linux-extras >/dev/null 2>&1; then
|
||||||
if [[ $(cat /etc/redhat-release) =~ "Red Hat" ]] && [[ $(uname -m) == "s390x" ]] || [[ $(cat /etc/redhat-release) =~ "CentOS" ]] || [[ $(cat /etc/redhat-release) =~ "Fedora" ]]; then
|
# For CentOS, Fedora, or RHEL(only s390x)
|
||||||
|
if [[ $(cat /etc/redhat-release) =~ "Red Hat" ]] && [[ $(uname -m) == "s390x" ]] || [[ $(cat /etc/redhat-release) =~ "CentOS" ]] || [[ $(cat /etc/redhat-release) =~ "Fedora" ]]; then
|
||||||
|
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||||
|
timeout $timeout sh get-docker.sh --channel stable --mirror $mirror
|
||||||
|
else
|
||||||
|
# For other distributions(Redhat and Rocky linux ...)
|
||||||
|
dnf --version >/dev/null 2>&1
|
||||||
|
dnf_status=$?
|
||||||
|
yum --version >/dev/null 2>&1
|
||||||
|
yum_status=$?
|
||||||
|
|
||||||
|
if [ $dnf_status -eq 0 ]; then
|
||||||
|
sudo dnf install dnf-utils -y > /dev/null
|
||||||
|
sudo dnf config-manager --add-repo $repo_url
|
||||||
|
timeout $timeout sudo dnf install $docker_packages -y
|
||||||
|
elif [ $yum_status -eq 0 ]; then
|
||||||
|
sudo yum install yum-utils -y > /dev/null
|
||||||
|
sudo yum-config-manager --add-repo $repo_url
|
||||||
|
if command -v amazon-linux-extras >/dev/null 2>&1; then
|
||||||
|
wget -O /etc/yum.repos.d/CentOS7-Base.repo https://websoft9.github.io/stackhub/apps/roles/role_common/files/CentOS7-Base.repo
|
||||||
|
sudo sed -i "s/\$releasever/7/g" /etc/yum.repos.d/docker-ce.repo
|
||||||
|
timeout $timeout sudo yum install $docker_packages --disablerepo='amzn2-extras,amzn2-core' -y
|
||||||
|
else
|
||||||
|
timeout $timeout sudo yum install $docker_packages -y
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "None of the required package managers are installed."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Ubuntu, Debian, or Raspbian
|
||||||
|
if type apt >/dev/null 2>&1; then
|
||||||
|
# Wait for apt to be unlocked
|
||||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||||
timeout $timeout sh get-docker.sh --channel stable --mirror $mirror
|
timeout $timeout sh get-docker.sh --channel stable --mirror $mirror
|
||||||
else
|
|
||||||
# For other distributions(Redhat and Rocky linux ...)
|
|
||||||
dnf --version >/dev/null 2>&1
|
|
||||||
dnf_status=$?
|
|
||||||
yum --version >/dev/null 2>&1
|
|
||||||
yum_status=$?
|
|
||||||
|
|
||||||
if [ $dnf_status -eq 0 ]; then
|
|
||||||
sudo dnf install dnf-utils -y > /dev/null
|
|
||||||
sudo dnf config-manager --add-repo $repo_url
|
|
||||||
timeout $timeout sudo dnf install $docker_packages -y
|
|
||||||
elif [ $yum_status -eq 0 ]; then
|
|
||||||
sudo yum install yum-utils -y > /dev/null
|
|
||||||
sudo yum-config-manager --add-repo $repo_url
|
|
||||||
if command -v amazon-linux-extras >/dev/null 2>&1; then
|
|
||||||
wget -O /etc/yum.repos.d/CentOS7-Base.repo https://websoft9.github.io/stackhub/apps/roles/role_common/files/CentOS7-Base.repo
|
|
||||||
sudo sed -i "s/\$releasever/7/g" /etc/yum.repos.d/docker-ce.repo
|
|
||||||
timeout $timeout sudo yum install $docker_packages --disablerepo='amzn2-extras,amzn2-core' -y
|
|
||||||
else
|
|
||||||
timeout $timeout sudo yum install $docker_packages -y
|
|
||||||
fi
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "None of the required package managers are installed."
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
echo "can not install by installation script, use special way to install docker"
|
||||||
|
dnf --version >/dev/null 2>&1
|
||||||
|
dnf_status=$?
|
||||||
|
yum --version >/dev/null 2>&1
|
||||||
|
yum_status=$?
|
||||||
|
apt --version >/dev/null 2>&1
|
||||||
|
apt_status=$?
|
||||||
|
|
||||||
|
if [ $dnf_status -eq 0 ]; then
|
||||||
|
sudo dnf install yum-utils -y
|
||||||
|
sudo dnf config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
|
||||||
|
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
elif [ $yum_status -eq 0 ]; then
|
||||||
|
sudo yum install yum-utils -y
|
||||||
|
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
|
||||||
|
sudo yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
elif [ $apt_status -eq 0 ]; then
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y ca-certificates curl gnupg lsb-release
|
||||||
|
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||||
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
|
else
|
||||||
|
echo "don't know package tool"
|
||||||
|
fi
|
||||||
|
|
||||||
|
sudo systemctl enable docker
|
||||||
|
sudo systemctl restart docker
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Ubuntu, Debian, or Raspbian
|
|
||||||
if type apt >/dev/null 2>&1; then
|
|
||||||
# Wait for apt to be unlocked
|
|
||||||
curl -fsSL https://get.docker.com -o get-docker.sh
|
|
||||||
timeout $timeout sh get-docker.sh --channel stable --mirror $mirror
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Upgrade_Docker(){
|
Upgrade_Docker(){
|
||||||
|
|
Loading…
Reference in a new issue