From 341a285de10ec87620a98f0044df3182559b1a46 Mon Sep 17 00:00:00 2001 From: vhsdream Date: Fri, 4 Apr 2025 01:46:57 -0400 Subject: [PATCH] Reactive-Resume: Browserless fix to only install Chromium; remove Python/playwright dep If we simply delete the unneeded browser dirs in `src/routes` then we don't need to install them. This will save compiling time and a lot of disk space. It's late for me so I haven't tested fully. --- ct/reactive-resume.sh | 39 +++++++++++++++--------------- install/reactive-resume-install.sh | 16 ++++++------ 2 files changed, 27 insertions(+), 28 deletions(-) diff --git a/ct/reactive-resume.sh b/ct/reactive-resume.sh index 1091a1d..300aa5e 100644 --- a/ct/reactive-resume.sh +++ b/ct/reactive-resume.sh @@ -37,10 +37,11 @@ function update_script() { msg_info "Updating $APP to v${RELEASE}" cp /opt/${APP}/.env /opt/rxresume.env - cd /tmp - wget -q "https://github.com/AmruthPillai/Reactive-Resume/archive/refs/tags/v${RELEASE}.zip" - unzip -q v${RELEASE}.zip - cp -r ${APP}-${RELEASE}/* /opt/${APP} + 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} corepack enable export PUPPETEER_SKIP_DOWNLOAD="true" @@ -59,35 +60,33 @@ function update_script() { $STD dpkg -i minio.deb msg_ok "Updated Minio" - msg_info "Updating Playwright" - $STD python3 -m pip install playwright --upgrade - msg_ok "Updated Playwright" - 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 - unzip -q v${TAG}.zip - cp -r browserless-${TAG}/* /opt/browserless + 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 update - $STD node_modules/playwright-core/cli.js install --with-deps chromium firefox webkit - $STD node_modules/playwright-core/cli.js install --force chrome msedge + $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 "Starting services" + msg_info "Restarting services" systemctl start minio Reactive-Resume browserless - msg_ok "Started services" + msg_ok "Restarted services" msg_info "Cleaning Up" rm -f /tmp/minio.deb - rm -f /tmp/v${RELEASE}.zip - rm -f /tmp/v${TAG}.zip - rm -rf /tmp/${APP}-${RELEASE} - rm -rf /tmp/browserless-${TAG} + rm -f $brwsr_tmp + rm -f $res_tmp msg_ok "Cleanup Completed" echo "${RELEASE}" >/opt/${APP}_version.txt diff --git a/install/reactive-resume-install.sh b/install/reactive-resume-install.sh index f9a25eb..e3bd1e4 100644 --- a/install/reactive-resume-install.sh +++ b/install/reactive-resume-install.sh @@ -20,9 +20,7 @@ $STD apt-get install -y \ mc \ gnupg \ unzip \ - postgresql-common \ - python3-pip -rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED + postgresql-common msg_ok "Installed Dependencies" msg_info "Installing Additional Dependencies" @@ -58,24 +56,25 @@ unzip -q v${RELEASE}.zip mv ${APPLICATION}-${RELEASE}/ /opt/${APPLICATION} cd /opt/${APPLICATION} corepack enable -export PUPPETEER_SKIP_DOWNLOAD="true" -export NEXT_TELEMETRY_DISABLED=1 export CI="true" +export PUPPETEER_SKIP_DOWNLOAD="true" +export NODE_ENV="production" +export NEXT_TELEMETRY_DISABLED=1 $STD pnpm install --frozen-lockfile $STD pnpm run build +$STD pnpm install --prod --frozen-lockfile $STD pnpm run prisma:generate msg_ok "Installed ${APPLICATION}" msg_info "Installing Browserless (Patience)" cd /tmp -$STD python3 -m pip install playwright wget -q https://github.com/browserless/browserless/archive/refs/tags/v${TAG}.zip unzip -q v${TAG}.zip mv browserless-${TAG} /opt/browserless cd /opt/browserless $STD npm install -$STD node_modules/playwright-core/cli.js install --with-deps chromium firefox webkit -$STD node_modules/playwright-core/cli.js install --force chrome msedge +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 @@ -187,6 +186,7 @@ customize msg_info "Cleaning up" rm -f /tmp/v${RELEASE}.zip +rm -f /tmp/v${TAG}.zip rm -f /tmp/minio.deb $STD apt-get -y autoremove $STD apt-get -y autoclean