mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-22 15:40:22 +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] - '
|
||||||
|
|
|
@ -61,6 +61,9 @@ Install_Docker(){
|
||||||
mirror=""
|
mirror=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
curl -fsSL --max-time 5 https://get.docker.com -o /dev/null
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
# For redhat family
|
# For redhat family
|
||||||
if [[ -f /etc/redhat-release ]] || command -v amazon-linux-extras >/dev/null 2>&1; then
|
if [[ -f /etc/redhat-release ]] || command -v amazon-linux-extras >/dev/null 2>&1; then
|
||||||
# For CentOS, Fedora, or RHEL(only s390x)
|
# For CentOS, Fedora, or RHEL(only s390x)
|
||||||
|
@ -101,6 +104,39 @@ Install_Docker(){
|
||||||
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
|
||||||
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
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Upgrade_Docker(){
|
Upgrade_Docker(){
|
||||||
|
|
Loading…
Reference in a new issue