mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-24 05:55:55 +01:00
Compare commits
1 Commits
main
...
booklore_v
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cedfa070a |
@@ -30,7 +30,7 @@ function update_script() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if check_for_gh_release "booklore" "booklore-app/BookLore"; then
|
if check_for_gh_release "booklore" "booklore-app/BookLore"; then
|
||||||
JAVA_VERSION="21" setup_java
|
JAVA_VERSION="25" setup_java
|
||||||
NODE_VERSION="22" setup_nodejs
|
NODE_VERSION="22" setup_nodejs
|
||||||
setup_mariadb
|
setup_mariadb
|
||||||
setup_yq
|
setup_yq
|
||||||
@@ -60,11 +60,16 @@ function update_script() {
|
|||||||
$STD npm run build --configuration=production
|
$STD npm run build --configuration=production
|
||||||
msg_ok "Built Frontend"
|
msg_ok "Built Frontend"
|
||||||
|
|
||||||
|
msg_info "Embedding Frontend into Backend"
|
||||||
|
mkdir -p /opt/booklore/booklore-api/src/main/resources/static
|
||||||
|
cp -r /opt/booklore/booklore-ui/dist/booklore/browser/* /opt/booklore/booklore-api/src/main/resources/static/
|
||||||
|
msg_ok "Embedded Frontend into Backend"
|
||||||
|
|
||||||
msg_info "Building Backend"
|
msg_info "Building Backend"
|
||||||
cd /opt/booklore/booklore-api
|
cd /opt/booklore/booklore-api
|
||||||
APP_VERSION=$(get_latest_github_release "booklore-app/BookLore")
|
APP_VERSION=$(get_latest_github_release "booklore-app/BookLore")
|
||||||
yq eval ".app.version = \"${APP_VERSION}\"" -i src/main/resources/application.yaml
|
yq eval ".app.version = \"${APP_VERSION}\"" -i src/main/resources/application.yaml
|
||||||
$STD ./gradlew clean build --no-daemon
|
$STD ./gradlew clean build -x test --no-daemon
|
||||||
mkdir -p /opt/booklore/dist
|
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)
|
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
|
if [[ -z "$JAR_PATH" ]]; then
|
||||||
@@ -74,9 +79,22 @@ function update_script() {
|
|||||||
cp "$JAR_PATH" /opt/booklore/dist/app.jar
|
cp "$JAR_PATH" /opt/booklore/dist/app.jar
|
||||||
msg_ok "Built Backend"
|
msg_ok "Built Backend"
|
||||||
|
|
||||||
|
if systemctl is-active --quiet nginx 2>/dev/null; then
|
||||||
|
msg_info "Removing Nginx (no longer needed)"
|
||||||
|
systemctl disable --now nginx
|
||||||
|
$STD apt-get purge -y nginx nginx-common
|
||||||
|
msg_ok "Removed Nginx"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep -q "^SERVER_PORT=" /opt/booklore_storage/.env 2>/dev/null; then
|
||||||
|
echo "SERVER_PORT=6060" >>/opt/booklore_storage/.env
|
||||||
|
fi
|
||||||
|
|
||||||
|
sed -i 's|ExecStart=/usr/bin/java -jar|ExecStart=/usr/bin/java -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+UseCompactObjectHeaders -jar|' /etc/systemd/system/booklore.service
|
||||||
|
systemctl daemon-reload
|
||||||
|
|
||||||
msg_info "Starting Service"
|
msg_info "Starting Service"
|
||||||
systemctl start booklore
|
systemctl start booklore
|
||||||
systemctl reload nginx
|
|
||||||
rm -rf /opt/booklore_bak
|
rm -rf /opt/booklore_bak
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
msg_ok "Updated successfully!"
|
msg_ok "Updated successfully!"
|
||||||
|
|||||||
@@ -13,11 +13,7 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Dependencies"
|
JAVA_VERSION="25" setup_java
|
||||||
$STD apt install -y nginx
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
JAVA_VERSION="21" setup_java
|
|
||||||
NODE_VERSION="22" setup_nodejs
|
NODE_VERSION="22" setup_nodejs
|
||||||
setup_mariadb
|
setup_mariadb
|
||||||
setup_yq
|
setup_yq
|
||||||
@@ -30,6 +26,11 @@ $STD npm install --force
|
|||||||
$STD npm run build --configuration=production
|
$STD npm run build --configuration=production
|
||||||
msg_ok "Built Frontend"
|
msg_ok "Built Frontend"
|
||||||
|
|
||||||
|
msg_info "Embedding Frontend into Backend"
|
||||||
|
mkdir -p /opt/booklore/booklore-api/src/main/resources/static
|
||||||
|
cp -r /opt/booklore/booklore-ui/dist/booklore/browser/* /opt/booklore/booklore-api/src/main/resources/static/
|
||||||
|
msg_ok "Embedded Frontend into Backend"
|
||||||
|
|
||||||
msg_info "Creating Environment"
|
msg_info "Creating Environment"
|
||||||
mkdir -p /opt/booklore_storage/{data,books,bookdrop}
|
mkdir -p /opt/booklore_storage/{data,books,bookdrop}
|
||||||
cat <<EOF >/opt/booklore_storage/.env
|
cat <<EOF >/opt/booklore_storage/.env
|
||||||
@@ -41,6 +42,7 @@ DATABASE_PASSWORD=${MARIADB_DB_PASS}
|
|||||||
# App Configuration (Spring Boot mapping from app.* properties)
|
# App Configuration (Spring Boot mapping from app.* properties)
|
||||||
APP_PATH_CONFIG=/opt/booklore_storage/data
|
APP_PATH_CONFIG=/opt/booklore_storage/data
|
||||||
APP_BOOKDROP_FOLDER=/opt/booklore_storage/bookdrop
|
APP_BOOKDROP_FOLDER=/opt/booklore_storage/bookdrop
|
||||||
|
SERVER_PORT=6060
|
||||||
EOF
|
EOF
|
||||||
msg_ok "Created Environment"
|
msg_ok "Created Environment"
|
||||||
|
|
||||||
@@ -48,7 +50,7 @@ msg_info "Building Backend"
|
|||||||
cd /opt/booklore/booklore-api
|
cd /opt/booklore/booklore-api
|
||||||
APP_VERSION=$(get_latest_github_release "booklore-app/BookLore")
|
APP_VERSION=$(get_latest_github_release "booklore-app/BookLore")
|
||||||
yq eval ".app.version = \"${APP_VERSION}\"" -i src/main/resources/application.yaml
|
yq eval ".app.version = \"${APP_VERSION}\"" -i src/main/resources/application.yaml
|
||||||
$STD ./gradlew clean build --no-daemon
|
$STD ./gradlew clean build -x test --no-daemon
|
||||||
mkdir -p /opt/booklore/dist
|
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)
|
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
|
if [[ -z "$JAR_PATH" ]]; then
|
||||||
@@ -58,16 +60,6 @@ fi
|
|||||||
cp "$JAR_PATH" /opt/booklore/dist/app.jar
|
cp "$JAR_PATH" /opt/booklore/dist/app.jar
|
||||||
msg_ok "Built Backend"
|
msg_ok "Built Backend"
|
||||||
|
|
||||||
msg_info "Configuring Nginx"
|
|
||||||
rm -rf /usr/share/nginx/html
|
|
||||||
ln -s /opt/booklore/booklore-ui/dist/booklore/browser /usr/share/nginx/html
|
|
||||||
rm -f /etc/nginx/sites-enabled/default
|
|
||||||
cp /opt/booklore/nginx.conf /etc/nginx/nginx.conf
|
|
||||||
sed -i 's/listen \${BOOKLORE_PORT};/listen 6060;/' /etc/nginx/nginx.conf
|
|
||||||
sed -i 's/listen \[::\]:${BOOKLORE_PORT};/listen [::]:6060;/' /etc/nginx/nginx.conf
|
|
||||||
systemctl restart nginx
|
|
||||||
msg_ok "Configured Nginx"
|
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/systemd/system/booklore.service
|
cat <<EOF >/etc/systemd/system/booklore.service
|
||||||
[Unit]
|
[Unit]
|
||||||
@@ -78,7 +70,7 @@ After=network.target mariadb.service
|
|||||||
Type=simple
|
Type=simple
|
||||||
User=root
|
User=root
|
||||||
WorkingDirectory=/opt/booklore/dist
|
WorkingDirectory=/opt/booklore/dist
|
||||||
ExecStart=/usr/bin/java -jar /opt/booklore/dist/app.jar
|
ExecStart=/usr/bin/java -XX:+UseG1GC -XX:+UseStringDeduplication -XX:+UseCompactObjectHeaders -jar /opt/booklore/dist/app.jar
|
||||||
EnvironmentFile=/opt/booklore_storage/.env
|
EnvironmentFile=/opt/booklore_storage/.env
|
||||||
SuccessExitStatus=143
|
SuccessExitStatus=143
|
||||||
TimeoutStopSec=10
|
TimeoutStopSec=10
|
||||||
|
|||||||
Reference in New Issue
Block a user