diff --git a/ct/notemark.sh b/ct/notemark.sh new file mode 100644 index 000000000..222ba8f85 --- /dev/null +++ b/ct/notemark.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env bash +_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func" +source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func") +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/enchant97/note-mark + +APP="Note Mark" +var_tags="${var_tags:-notes;markdown}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-8}" +var_os="${var_os:-debian}" +var_version="${var_version:-13}" +var_arm64="${var_arm64:-yes}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -d /opt/notemark ]]; then + msg_error "No Note Mark Installation Found!" + exit + fi + + if check_for_gh_release "notemark" "enchant97/note-mark"; then + msg_info "Stopping Note Mark" + systemctl stop notemark + msg_ok "Stopped Note Mark" + + setup_go + NODE_VERSION="24" NODE_MODULE="pnpm@11" setup_nodejs + RUST_PROFILE="minimal" setup_rust + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "notemark" "enchant97/note-mark" "tarball" + + msg_info "Building Note Mark" + $STD rustup target add wasm32-unknown-unknown + cd /opt/notemark/frontend + $STD pnpm install --frozen-lockfile + $STD pnpm run wasm + $STD pnpm run build + cd /opt/notemark/backend + $STD go tool sqlc generate + CGO_ENABLED=0 $STD go build -ldflags "-X main.Version=$(cat ~/.notemark)" -o /opt/notemark/note-mark + rm -rf /opt/notemark/frontend/node_modules /opt/notemark/frontend/renderer/target + $STD go clean -cache -modcache + msg_ok "Built Note Mark" + + msg_info "Starting Note Mark" + systemctl start notemark + msg_ok "Started Note Mark" + msg_ok "Updated successfully!" + fi + exit +} + +start +build_container +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 "${GATEWAY}${BGN}http://${IP}:8080${CL}" diff --git a/install/notemark-install.sh b/install/notemark-install.sh new file mode 100644 index 000000000..802ebd3de --- /dev/null +++ b/install/notemark-install.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (CanbiZ) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/enchant97/note-mark + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Installing Dependencies" +$STD apt install -y build-essential +msg_ok "Installed Dependencies" + +setup_go +NODE_VERSION="24" NODE_MODULE="pnpm@11" setup_nodejs +RUST_PROFILE="minimal" setup_rust + +fetch_and_deploy_gh_release "notemark" "enchant97/note-mark" "tarball" + +msg_info "Building Note Mark" +$STD rustup target add wasm32-unknown-unknown +cd /opt/notemark/frontend +$STD pnpm install --frozen-lockfile +$STD pnpm run wasm +$STD pnpm run build +cd /opt/notemark/backend +$STD go tool sqlc generate +CGO_ENABLED=0 $STD go build -ldflags "-X main.Version=$(cat ~/.notemark)" -o /opt/notemark/note-mark +rm -rf /opt/notemark/frontend/node_modules /opt/notemark/frontend/renderer/target +$STD go clean -cache -modcache +msg_ok "Built Note Mark" + +msg_info "Configuring Note Mark" +mkdir -p /opt/notemark_data +cat </opt/notemark_data/.env +BIND__HOST=0.0.0.0 +BIND__PORT=8080 +DATA_PATH=/opt/notemark_data +STATIC_PATH=/opt/notemark/frontend/dist +PUBLIC_URL=http://${LOCAL_IP}:8080 +AUTH_TOKEN__SECRET=$(openssl rand -base64 32) +ENABLE_INTERNAL_SIGNUP=true +EOF +chmod 600 /opt/notemark_data/.env +msg_ok "Configured Note Mark" + +msg_info "Creating Service" +cat </etc/systemd/system/notemark.service +[Unit] +Description=Note Mark +After=network.target + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/notemark_data +EnvironmentFile=/opt/notemark_data/.env +ExecStart=/opt/notemark/note-mark serve +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now notemark +msg_ok "Created Service" + +motd_ssh +customize +cleanup_lxc