Refactor (#6376)
This commit is contained in:
parent
2701308b45
commit
53beca39e8
27
ct/kubo.sh
27
ct/kubo.sh
@ -23,21 +23,24 @@ function update_script() {
|
|||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
if [[ ! -f /usr/local/kubo ]]; then
|
if [[ ! -f /usr/local/kubo/ipfs ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
RELEASE=$(curl -fsSL https://github.com/ipfs/kubo/releases/latest | grep "title>Release" | cut -d " " -f 4)
|
|
||||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
RELEASE=$(curl -fsSL https://api.github.com/repos/ipfs/kubo/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
msg_info "Updating $APP LXC"
|
if [[ "${RELEASE}" != "$(cat ~/.kubo)" ]] || [[ ! -f ~/.kubo ]]; then
|
||||||
$STD apt-get update
|
msg_info "Stopping service"
|
||||||
$STD apt-get -y upgrade
|
systemctl stop ipfs
|
||||||
curl -fsSL "https://github.com/ipfs/kubo/releases/download/${RELEASE}/kubo_${RELEASE}_linux-amd64.tar.gz" -o $(basename "https://github.com/ipfs/kubo/releases/download/${RELEASE}/kubo_${RELEASE}_linux-amd64.tar.gz")
|
msg_ok "Stopped service"
|
||||||
tar -xzf "kubo_${RELEASE}_linux-amd64.tar.gz" -C /usr/local
|
|
||||||
systemctl restart ipfs.service
|
fetch_and_deploy_gh_release "kubo" "ipfs/kubo" "prebuild" "latest" "/usr/local/kubo" "kubo*linux-amd64.tar.gz"
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
|
||||||
rm "kubo_${RELEASE}_linux-amd64.tar.gz"
|
msg_info "Starting service"
|
||||||
msg_ok "Updated $APP LXC"
|
systemctl start ipfs
|
||||||
|
msg_ok "Service started"
|
||||||
|
|
||||||
|
msg_ok "Updated successfuly"
|
||||||
else
|
else
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||||
fi
|
fi
|
||||||
|
@ -14,10 +14,9 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing IPFS"
|
fetch_and_deploy_gh_release "kubo" "ipfs/kubo" "prebuild" "latest" "/usr/local/kubo" "kubo*linux-amd64.tar.gz"
|
||||||
RELEASE=$(curl -fsSL https://github.com/ipfs/kubo/releases/latest | grep "title>Release" | cut -d " " -f 4)
|
|
||||||
$STD curl -fsSL "https://github.com/ipfs/kubo/releases/download/${RELEASE}/kubo_${RELEASE}_linux-amd64.tar.gz" -o "kubo_${RELEASE}_linux-amd64.tar.gz"
|
msg_info "Configuring IPFS"
|
||||||
tar -xzf "kubo_${RELEASE}_linux-amd64.tar.gz" -C /usr/local
|
|
||||||
$STD ln -s /usr/local/kubo/ipfs /usr/local/bin/ipfs
|
$STD ln -s /usr/local/kubo/ipfs /usr/local/bin/ipfs
|
||||||
$STD ipfs init
|
$STD ipfs init
|
||||||
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
|
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
|
||||||
@ -25,9 +24,7 @@ ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
|
|||||||
LXCIP=$(hostname -I | awk '{print $1}')
|
LXCIP=$(hostname -I | awk '{print $1}')
|
||||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://${LXCIP}:5001\", \"http://localhost:3000\", \"http://127.0.0.1:5001\", \"https://webui.ipfs.io\", \"http://0.0.0.0:5001\"]"
|
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://${LXCIP}:5001\", \"http://localhost:3000\", \"http://127.0.0.1:5001\", \"https://webui.ipfs.io\", \"http://0.0.0.0:5001\"]"
|
||||||
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]'
|
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]'
|
||||||
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
|
msg_ok "Configured IPFS"
|
||||||
$STD rm "kubo_${RELEASE}_linux-amd64.tar.gz"
|
|
||||||
msg_ok "Installed IPFS"
|
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/systemd/system/ipfs.service
|
cat <<EOF >/etc/systemd/system/ipfs.service
|
||||||
@ -43,7 +40,7 @@ Environment=HOME=/root
|
|||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable --now -q ipfs.service
|
systemctl enable -q --now ipfs
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
|
Loading…
x
Reference in New Issue
Block a user