From deb8b156975a0dca91cfbf73ae38cd8d5e2e6961 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 14 Apr 2025 15:06:09 +0200 Subject: [PATCH] ficxes --- ct/reactive-resume.sh | 145 ++++++++++++++--------------- install/reactive-resume-install.sh | 28 +++--- 2 files changed, 86 insertions(+), 87 deletions(-) diff --git a/ct/reactive-resume.sh b/ct/reactive-resume.sh index 6dc6665..3032b69 100644 --- a/ct/reactive-resume.sh +++ b/ct/reactive-resume.sh @@ -20,81 +20,80 @@ color catch_errors function update_script() { - header_info - check_container_storage - check_container_resources + header_info + check_container_storage + check_container_resources - if [[ ! -f /etc/systemd/system/Reactive-Resume.service ]]; then - msg_error "No ${APP} Installation Found!" + if [[ ! -f /etc/systemd/system/Reactive-Resume.service ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/AmruthPillai/Reactive-Resume/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping services" + systemctl stop Reactive-Resume + msg_ok "Stopped services" + + msg_info "Updating $APP to v${RELEASE}" + cp /opt/${APP}/.env /opt/rxresume.env + res_tmp=$(mktemp) + rm -rf /opt/${APP} + curl -fsSL "https://github.com/AmruthPillai/Reactive-Resume/archive/refs/tags/v${RELEASE}.zip" -O $res_tmp + unzip -q $res_tmp + mv ${APP}-${RELEASE}/ /opt/${APP} + cd /opt/${APP} + export PUPPETEER_SKIP_DOWNLOAD="true" + export NEXT_TELEMETRY_DISABLED=1 + export CI="true" + export NODE_ENV="production" + $STD pnpm install --frozen-lockfile + $STD pnpm run build + $STD pnpm run prisma:generate + mv /opt/rxresume.env /opt/${APP}/.env + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Updating Minio" + systemctl stop minio + cd /tmp + curl -fsSL https://dl.min.io/server/minio/release/linux-amd64/minio.deb -o minio.deb + $STD dpkg -i minio.deb + msg_ok "Updated Minio" + + msg_info "Updating Browserless (Patience)" + systemctl stop browserless + cp /opt/browserless/.env /opt/browserless.env + rm -rf browserless + brwsr_tmp=$(mktemp) + TAG=$(curl -fsSL https://api.github.com/repos/browserless/browserless/tags?per_page=1 | grep "name" | awk '{print substr($2, 3, length($2)-4) }') + curl -fsSL https://github.com/browserless/browserless/archive/refs/tags/v${TAG}.zip -O $brwsr_tmp + unzip -q $brwsr_tmp + mv browserless-${TAG}/ /opt/browserless + cd /opt/browserless + $STD npm install + rm -rf src/routes/{chrome,edge,firefox,webkit} + $STD node_modules/playwright-core/cli.js install --with-deps chromium + $STD npm run build + $STD npm run build:function + $STD npm prune production + mv /opt/browserless.env /opt/browserless/.env + msg_ok "Updated Browserless" + + msg_info "Restarting services" + systemctl start minio Reactive-Resume browserless + msg_ok "Restarted services" + + msg_info "Cleaning Up" + rm -f /tmp/minio.deb + rm -f $brwsr_tmp + rm -f $res_tmp + msg_ok "Cleanup Completed" + + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + fi exit - fi - - RELEASE=$(curl -s https://api.github.com/repos/AmruthPillai/Reactive-Resume/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then - msg_info "Stopping services" - systemctl stop Reactive-Resume - msg_ok "Stopped services" - - msg_info "Updating $APP to v${RELEASE}" - cp /opt/${APP}/.env /opt/rxresume.env - res_tmp=$(mktemp) - rm -rf /opt/${APP} - wget -q "https://github.com/AmruthPillai/Reactive-Resume/archive/refs/tags/v${RELEASE}.zip" -O $res_tmp - unzip -q $res_tmp - mv ${APP}-${RELEASE}/ /opt/${APP} - cd /opt/${APP} - export PUPPETEER_SKIP_DOWNLOAD="true" - export NEXT_TELEMETRY_DISABLED=1 - export CI="true" - export NODE_ENV="production" - $STD pnpm install --frozen-lockfile - $STD pnpm run build - $STD pnpm run prisma:generate - mv /opt/rxresume.env /opt/${APP}/.env - msg_ok "Updated $APP to v${RELEASE}" - - msg_info "Updating Minio" - systemctl stop minio - cd /tmp - wget -q https://dl.min.io/server/minio/release/linux-amd64/minio.deb - $STD dpkg -i minio.deb - msg_ok "Updated Minio" - - msg_info "Updating Browserless (Patience)" - systemctl stop browserless - cp /opt/browserless/.env /opt/browserless.env - rm -rf browserless - brwsr_tmp=$(mktemp) - TAG=$(curl -s https://api.github.com/repos/browserless/browserless/tags?per_page=1 | grep "name" | awk '{print substr($2, 3, length($2)-4) }') - wget -q https://github.com/browserless/browserless/archive/refs/tags/v${TAG}.zip -O $brwsr_tmp - unzip -q $brwsr_tmp - mv browserless-${TAG}/ /opt/browserless - cd /opt/browserless - $STD npm install - rm -rf src/routes/{chrome,edge,firefox,webkit} - $STD node_modules/playwright-core/cli.js install --with-deps chromium - $STD npm run build - $STD npm run build:function - $STD npm prune production - mv /opt/browserless.env /opt/browserless/.env - msg_ok "Updated Browserless" - - msg_info "Restarting services" - systemctl start minio Reactive-Resume browserless - msg_ok "Restarted services" - - msg_info "Cleaning Up" - rm -f /tmp/minio.deb - rm -f $brwsr_tmp - rm -f $res_tmp - msg_ok "Cleanup Completed" - - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Update Successful" - else - msg_ok "No update required. ${APP} is already at v${RELEASE}" - fi - exit } start diff --git a/install/reactive-resume-install.sh b/install/reactive-resume-install.sh index a429f72..f94299c 100644 --- a/install/reactive-resume-install.sh +++ b/install/reactive-resume-install.sh @@ -15,9 +15,9 @@ update_os msg_info "Installing Dependencies" $STD apt-get install -y \ - gnupg \ - unzip \ - postgresql-common + gnupg \ + unzip \ + postgresql-common msg_ok "Installed Dependencies" msg_info "Installing Additional Dependencies" @@ -27,7 +27,7 @@ echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.co echo "YES" | /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh &>/dev/null $STD apt-get install -y postgresql-16 nodejs cd /tmp -wget -q https://dl.min.io/server/minio/release/linux-amd64/minio.deb +curl -fsSL https://dl.min.io/server/minio/release/linux-amd64/minio.deb -o minio.deb $STD dpkg -i minio.deb msg_info "Setting up Database" @@ -46,9 +46,9 @@ ACCESS_TOKEN=$(openssl rand -base64 48) REFRESH_TOKEN=$(openssl rand -base64 48) CHROME_TOKEN=$(openssl rand -hex 32) LOCAL_IP=$(hostname -I | awk '{print $1}') -TAG=$(curl -s https://api.github.com/repos/browserless/browserless/tags?per_page=1 | grep "name" | awk '{print substr($2, 3, length($2)-4) }') -RELEASE=$(curl -s https://api.github.com/repos/AmruthPillai/Reactive-Resume/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') -wget -q "https://github.com/AmruthPillai/Reactive-Resume/archive/refs/tags/v${RELEASE}.zip" +TAG=$(curl -fsSL https://api.github.com/repos/browserless/browserless/tags?per_page=1 | grep "name" | awk '{print substr($2, 3, length($2)-4) }') +RELEASE=$(curl -fsSL https://api.github.com/repos/AmruthPillai/Reactive-Resume/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +curl -fsSL "https://github.com/AmruthPillai/Reactive-Resume/archive/refs/tags/v${RELEASE}.zip" -o v${RELEASE}.zip unzip -q v${RELEASE}.zip mv ${APPLICATION}-${RELEASE}/ /opt/${APPLICATION} cd /opt/${APPLICATION} @@ -65,7 +65,7 @@ msg_ok "Installed ${APPLICATION}" msg_info "Installing Browserless (Patience)" cd /tmp -wget -q https://github.com/browserless/browserless/archive/refs/tags/v${TAG}.zip +curl -fsSL https://github.com/browserless/browserless/archive/refs/tags/v${TAG}.zip -o v${TAG}.zip unzip -q v${TAG}.zip mv browserless-${TAG} /opt/browserless cd /opt/browserless @@ -98,7 +98,7 @@ CHROME_TOKEN=${CHROME_TOKEN} CHROME_URL=ws://localhost:8080 CHROME_IGNORE_HTTPS_ERRORS=true MAIL_FROM=noreply@locahost -# SMTP_URL=smtp://username:password@smtp.server.mail:587 # +# SMTP_URL=smtp://username:password@smtp.server.mail:587 # STORAGE_ENDPOINT=localhost STORAGE_PORT=9000 STORAGE_REGION=us-east-1 @@ -126,11 +126,11 @@ TOKEN=${CHROME_TOKEN} EOF echo "${RELEASE}" >/opt/${APPLICATION}_version.txt { - echo "${APPLICATION} Credentials" - echo "Database User: $DB_USER" - echo "Database Password: $DB_PASS" - echo "Database Name: $DB_NAME" - echo "Minio Root Password: ${MINIO_PASS}" + echo "${APPLICATION} Credentials" + echo "Database User: $DB_USER" + echo "Database Password: $DB_PASS" + echo "Database Name: $DB_NAME" + echo "Minio Root Password: ${MINIO_PASS}" } >>~/${APPLICATION}.creds msg_ok "Configured applications"