diff --git a/ct/memos.sh b/ct/memos.sh index ea923a64f..893af104b 100644 --- a/ct/memos.sh +++ b/ct/memos.sh @@ -7,9 +7,9 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV APP="Memos" var_tags="${var_tags:-notes}" -var_cpu="${var_cpu:-2}" -var_ram="${var_ram:-3072}" -var_disk="${var_disk:-7}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-1024}" +var_disk="${var_disk:-3}" var_os="${var_os:-debian}" var_version="${var_version:-12}" var_unprivileged="${var_unprivileged:-1}" @@ -27,26 +27,23 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_info "Updating $APP (Patience)" - cd /opt/memos - git reset --hard HEAD - output=$(git pull --no-rebase) - if echo "$output" | grep -q "Already up to date."; then - msg_ok "$APP is already up to date." - exit + + RELEASE=$(curl -fsSL https://api.github.com/repos/usememos/memos/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ "${RELEASE}" != "$(cat ~/.memos 2>/dev/null)" ]] || [[ ! -f ~/.memos ]]; then + msg_info "Stopping service" + systemctl stop memos + msg_ok "Service stopped" + + fetch_and_deploy_gh_release "memos" "usememos/memos" "prebuild" "latest" "/opt/memos" "memos*linux_amd64.tar.gz" + + msg_info "Starting service" + systemctl start memos + msg_ok "Service started" + + msg_ok "Updated successfully" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" fi - systemctl stop memos - export NODE_OPTIONS="--max-old-space-size=2048" - cd /opt/memos/web - $STD pnpm i --frozen-lockfile - $STD pnpm build - cd /opt/memos - mkdir -p /opt/memos/server/dist - cp -r web/dist/* /opt/memos/server/dist/ - cp -r web/dist/* /opt/memos/server/router/frontend/dist/ - $STD go build -o /opt/memos/memos -tags=embed bin/memos/main.go - systemctl start memos - msg_ok "Updated $APP" exit } @@ -57,4 +54,4 @@ description msg_ok "Completed Successfully!\n" 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}:9030${CL}" \ No newline at end of file +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:9030${CL}" diff --git a/frontend/public/json/memos.json b/frontend/public/json/memos.json index ac9400c0f..0d5bcf0b5 100644 --- a/frontend/public/json/memos.json +++ b/frontend/public/json/memos.json @@ -19,9 +19,9 @@ "type": "default", "script": "ct/memos.sh", "resources": { - "cpu": 2, - "ram": 3072, - "hdd": 7, + "cpu": 1, + "ram": 1024, + "hdd": 3, "os": "debian", "version": "12" } diff --git a/install/memos-install.sh b/install/memos-install.sh index 12d6573f2..6060d6bc3 100644 --- a/install/memos-install.sh +++ b/install/memos-install.sh @@ -14,29 +14,8 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt-get install -y \ - build-essential \ - git \ - tzdata -msg_ok "Installed Dependencies" - -NODE_VERSION="22" NODE_MODULE="pnpm@latest" setup_nodejs -setup_go - -msg_info "Installing Memos (Patience)" +fetch_and_deploy_gh_release "memos" "usememos/memos" "prebuild" "latest" "/opt/memos" "memos*linux_amd64.tar.gz" mkdir -p /opt/memos_data -export NODE_OPTIONS="--max-old-space-size=2048" -$STD git clone https://github.com/usememos/memos.git /opt/memos -cd /opt/memos/web -$STD pnpm i --frozen-lockfile -$STD pnpm build -cd /opt/memos -mkdir -p /opt/memos/server/dist -cp -r web/dist/* /opt/memos/server/dist/ -cp -r web/dist/* /opt/memos/server/router/frontend/dist/ -$STD go build -o /opt/memos/memos -tags=embed bin/memos/main.go -msg_ok "Installed Memos" msg_info "Creating Service" cat </etc/systemd/system/memos.service