Update booklore.sh
This commit is contained in:
parent
2579987fc5
commit
dc9926a688
@ -7,9 +7,9 @@ source <(curl -s https://git.community-scripts.org/community-scripts/ProxmoxVED/
|
|||||||
|
|
||||||
APP="BookLore"
|
APP="BookLore"
|
||||||
var_tags="${var_tags:-books;library}"
|
var_tags="${var_tags:-books;library}"
|
||||||
var_cpu="${var_cpu:-2}"
|
var_cpu="${var_cpu:-1}"
|
||||||
var_ram="${var_ram:-2048}"
|
var_ram="${var_ram:-2048}"
|
||||||
var_disk="${var_disk:-5}"
|
var_disk="${var_disk:-7}"
|
||||||
var_os="${var_os:-debian}"
|
var_os="${var_os:-debian}"
|
||||||
var_version="${var_version:-12}"
|
var_version="${var_version:-12}"
|
||||||
var_unprivileged="${var_unprivileged:-1}"
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
@ -23,14 +23,49 @@ function update_script() {
|
|||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
if [[ ! -d /var ]]; then
|
|
||||||
|
if [[ ! -d /opt/booklore ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
msg_info "Updating $APP LXC"
|
|
||||||
$STD apt-get update
|
RELEASE=$(curl -fsSL https://api.github.com/repos/adityachandelgit/BookLore/releases/latest | yq '.tag_name' | sed 's/^v//')
|
||||||
$STD apt-get -y upgrade
|
if [[ "${RELEASE}" != "$(cat ~/.booklore 2>/dev/null)" ]] || [[ ! -f ~/.booklore ]]; then
|
||||||
msg_ok "Updated $APP LXC"
|
msg_info "Stopping $APP"
|
||||||
|
systemctl stop booklore
|
||||||
|
msg_ok "Stopped $APP"
|
||||||
|
|
||||||
|
fetch_and_deploy_gh_release "booklore" "adityachandelgit/BookLore"
|
||||||
|
|
||||||
|
msg_info "Building Frontend"
|
||||||
|
cd /opt/booklore/booklore-ui
|
||||||
|
$STD npm install --force
|
||||||
|
$STD npm run build --configuration=production
|
||||||
|
msg_ok "Built Frontend"
|
||||||
|
|
||||||
|
msg_info "Building Backend"
|
||||||
|
cd /opt/booklore/booklore-api
|
||||||
|
APP_VERSION=$(curl -fsSL https://api.github.com/repos/adityachandelgit/BookLore/releases/latest | yq '.tag_name' | sed 's/^v//')
|
||||||
|
yq eval ".app.version = \"${APP_VERSION}\"" -i src/main/resources/application.yaml
|
||||||
|
$STD ./gradlew clean build --no-daemon
|
||||||
|
mkdir -p /opt/booklore/dist
|
||||||
|
JAR_PATH=$(find /opt/booklore/booklore-api/build/libs -maxdepth 1 -type f -name "booklore-api-*.jar" ! -name "*plain*" | head -n1)
|
||||||
|
if [[ -z "$JAR_PATH" ]]; then
|
||||||
|
msg_error "Backend JAR not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
cp "$JAR_PATH" /opt/booklore/dist/app.jar
|
||||||
|
msg_ok "Built Backend"
|
||||||
|
|
||||||
|
msg_info "Starting $APP"
|
||||||
|
systemctl start booklore
|
||||||
|
systemctl reload nginx
|
||||||
|
msg_ok "Started $APP"
|
||||||
|
|
||||||
|
msg_ok "Update Successful"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,3 +75,5 @@ description
|
|||||||
|
|
||||||
msg_ok "Completed Successfully!\n"
|
msg_ok "Completed Successfully!\n"
|
||||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:6060${CL}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user