mirror of
https://github.com/Websoft9/websoft9.git
synced 2025-02-03 01:28:39 +08:00
fix
This commit is contained in:
parent
87affee25d
commit
85f9be3c04
@ -1,2 +1,2 @@
|
|||||||
1. Fix install error: docker not found
|
1. Fix install error: apt locked
|
||||||
2. Fix install error: cockpit.socket not found
|
2. Install: add Docker daemon.json
|
||||||
|
@ -174,40 +174,65 @@ check_ports() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
merge_daemon_files() {
|
source_github_pages="https://websoft9.github.io/websoft9"
|
||||||
remote_url="$1"
|
install_path="/data/websoft9/source"
|
||||||
local_file="$2"
|
|
||||||
|
|
||||||
python3 - <<END
|
|
||||||
|
merge_json_files() {
|
||||||
|
local target_path="/etc/docker/daemon.json"
|
||||||
|
|
||||||
|
python3 - <<EOF 2>/dev/null
|
||||||
import json
|
import json
|
||||||
import requests
|
import urllib.request
|
||||||
|
import os
|
||||||
|
|
||||||
# 获取远程 daemon.json 文件的内容
|
def merge_json_files(file1, file2):
|
||||||
response = requests.get("$remote_url")
|
print("Merge from local file... ")
|
||||||
remote_daemon = response.json()
|
with open(file1, 'r') as f1, open(file2, 'r') as f2:
|
||||||
|
data1 = json.load(f1)
|
||||||
|
data2 = json.load(f2)
|
||||||
|
|
||||||
# 读取本地的 daemon.json 文件
|
merged_data = {**data1, **data2}
|
||||||
with open("$local_file", 'r') as f:
|
|
||||||
local_daemon = json.load(f)
|
|
||||||
|
|
||||||
# 合并本地和远程的 daemon.json 文件内容
|
with open(file1, 'w') as f:
|
||||||
local_daemon.update(remote_daemon)
|
json.dump(merged_data, f, indent=4)
|
||||||
|
|
||||||
# 将合并后的内容写入到本地的 daemon.json 文件中
|
def download_and_merge(url, file_path):
|
||||||
with open("$local_file", 'w') as f:
|
print("Download daemon.json from url and merge... ")
|
||||||
json.dump(local_daemon, f, indent=4)
|
with urllib.request.urlopen(url) as response:
|
||||||
END
|
data = json.loads(response.read().decode())
|
||||||
|
|
||||||
|
with open(file_path, 'r') as f:
|
||||||
|
local_data = json.load(f)
|
||||||
|
|
||||||
|
merged_data = {**local_data, **data}
|
||||||
|
|
||||||
|
with open(file_path, 'w') as f:
|
||||||
|
json.dump(merged_data, f, indent=4)
|
||||||
|
|
||||||
|
# Create target file if it does not exist
|
||||||
|
if not os.path.exists("${target_path}"):
|
||||||
|
os.makedirs(os.path.dirname("${target_path}"), exist_ok=True)
|
||||||
|
with open("${target_path}", 'w') as f:
|
||||||
|
json.dump({}, f)
|
||||||
|
|
||||||
|
if os.path.exists("${install_path}/docker/daemon.json"):
|
||||||
|
merge_json_files("${target_path}", "${install_path}/docker/daemon.json")
|
||||||
|
elif urllib.request.urlopen("${source_github_pages}/docker/daemon.json").getcode() == 200:
|
||||||
|
download_and_merge("${source_github_pages}/docker/daemon.json", "${target_path}")
|
||||||
|
else:
|
||||||
|
print("No target daemon.json file need to merged")
|
||||||
|
EOF
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "merge daemon.json failed, but install continue running"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
set_docker(){
|
set_docker(){
|
||||||
echo "Set Docker for Websoft9 backend service..."
|
echo "Set Docker for Websoft9 backend service..."
|
||||||
|
merge_json_files
|
||||||
if [ -f "${install_path}/docker/daemon.json" ]; then
|
|
||||||
merge_daemon_files "${install_path}/docker/daemon.json" "/etc/docker/daemon.json"
|
|
||||||
else
|
|
||||||
merge_daemon_files "${source_github_pages}/docker/daemon.json" "/etc/docker/daemon.json"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! docker network inspect websoft9 > /dev/null 2>&1; then
|
if ! docker network inspect websoft9 > /dev/null 2>&1; then
|
||||||
sudo docker network create websoft9
|
sudo docker network create websoft9
|
||||||
sudo systemctl restart docker
|
sudo systemctl restart docker
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "0.8.26-rc3",
|
"version": "0.8.26-rc4",
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"portainer": "0.0.6",
|
"portainer": "0.0.6",
|
||||||
"nginx": "0.0.5",
|
"nginx": "0.0.5",
|
||||||
|
Loading…
Reference in New Issue
Block a user