diff --git a/ct/wallabag.sh b/ct/wallabag.sh index de8b9f85..46eb8ff0 100644 --- a/ct/wallabag.sh +++ b/ct/wallabag.sh @@ -5,7 +5,6 @@ source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxV # License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE # Source: https://wallabag.org/ -# App Default Values APP="Wallabag" var_tags="${var_tags:-productivity;read-it-later}" var_cpu="${var_cpu:-2}" @@ -15,11 +14,7 @@ var_os="${var_os:-debian}" var_version="${var_version:-12}" var_unprivileged="${var_unprivileged:-1}" -# App Output & Base Settings header_info "$APP" -base_settings - -# Core variables color catch_errors @@ -28,61 +23,45 @@ function update_script() { header_info check_container_storage check_container_resources + if [[ ! -d /opt/wallabag ]]; then msg_error "No ${APP} Installation Found!" exit fi - RELEASE=$(curl -fsSL https://api.github.com/repos/wallabag/wallabag/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') - if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt 2>/dev/null)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + if check_for_gh_release "wallabag" "wallabag/wallabag"; then msg_info "Stopping Services" - systemctl stop nginx - systemctl stop php8.3-fpm + systemctl stop nginx php8.3-fpm msg_ok "Stopped Services" - msg_info "Backing up Wallabag" + msg_info "Creating Backup" cp /opt/wallabag/app/config/parameters.yml /tmp/wallabag_parameters.yml.bak - msg_ok "Backed up Configuration" + msg_ok "Created Backup" - msg_info "Updating $APP to v${RELEASE}" - cd /tmp - wget -q "https://github.com/wallabag/wallabag/releases/download/${RELEASE}/wallabag-${RELEASE#v}.tar.gz" - tar -xzf "wallabag-${RELEASE#v}.tar.gz" - - rm -rf /opt/wallabag/vendor /opt/wallabag/var/cache/* - cp -rf wallabag-${RELEASE#v}/* /opt/wallabag/ + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "wallabag" "wallabag/wallabag" "prebuild" "latest" "/opt/wallabag" "wallabag-*.tar.gz" + msg_info "Restoring Configuration" cp /tmp/wallabag_parameters.yml.bak /opt/wallabag/app/config/parameters.yml + rm -f /tmp/wallabag_parameters.yml.bak + msg_ok "Restored Configuration" + msg_info "Running Migrations" cd /opt/wallabag - export COMPOSER_ALLOW_SUPERUSER=1 - $STD composer install --no-dev --prefer-dist --optimize-autoloader --no-interaction $STD php bin/console cache:clear --env=prod $STD php bin/console doctrine:migrations:migrate --env=prod --no-interaction - - chown -R wallabag:wallabag /opt/wallabag + chown -R www-data:www-data /opt/wallabag chmod -R 755 /opt/wallabag/var chmod -R 755 /opt/wallabag/web/assets - - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated $APP to v${RELEASE}" - - msg_info "Cleaning Up" - rm -rf /tmp/wallabag-${RELEASE#v}* - rm -f /tmp/wallabag_parameters.yml.bak - msg_ok "Cleanup Completed" + msg_ok "Ran Migrations" msg_info "Starting Services" - systemctl start php8.3-fpm - systemctl start nginx + systemctl start php8.3-fpm nginx msg_ok "Started Services" - - msg_ok "Update Successful" - else - msg_ok "No update required. ${APP} is already at v${RELEASE}" + msg_ok "Updated successfully!" fi exit } + start build_container description diff --git a/install/wallabag-install.sh b/install/wallabag-install.sh index 0eaa0a33..f9723df9 100644 --- a/install/wallabag-install.sh +++ b/install/wallabag-install.sh @@ -20,6 +20,7 @@ $STD apt install -y \ imagemagick msg_ok "Installed Dependencies" +import_local_ip setup_mariadb MARIADB_DB_NAME="wallabag" MARIADB_DB_USER="wallabag" setup_mariadb_db PHP_VERSION="8.3" PHP_FPM="YES" PHP_MODULE="bcmath,bz2,curl,gd,imagick,intl,mbstring,mysql,redis,tidy,xml,zip" setup_php @@ -31,7 +32,6 @@ fetch_and_deploy_gh_release "wallabag" "wallabag/wallabag" "prebuild" "latest" " msg_info "Configuring Wallabag" cd /opt/wallabag SECRET_KEY="$(openssl rand -base64 32 | tr -dc 'a-zA-Z0-9' | cut -c1-32)" -CONTAINER_IP=$(hostname -I | awk '{print $1}') cat </opt/wallabag/app/config/parameters.yml parameters: database_driver: pdo_mysql @@ -45,7 +45,7 @@ parameters: database_socket: null database_charset: utf8mb4 - domain_name: http://${CONTAINER_IP}:8000 + domain_name: http://${LOCAL_IP}:8000 server_name: Wallabag mailer_dsn: null