mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-12-03 21:38:08 +01:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5076350fe3 | ||
|
|
2932262053 | ||
|
|
0dee0a10e9 |
No files matched your search
+23
-17
@@ -31,17 +31,26 @@ function update_script() {
|
||||
exit
|
||||
fi
|
||||
|
||||
RELEASE="v0.27.3"
|
||||
if [[ -f /etc/systemd/system/affine-worker.service ]]; then
|
||||
msg_info "Removing affine-worker Service"
|
||||
systemctl disable -q --now affine-worker
|
||||
rm -f /etc/systemd/system/affine-worker.service
|
||||
systemctl daemon-reload
|
||||
systemctl restart affine-web
|
||||
msg_ok "Removed affine-worker Service"
|
||||
fi
|
||||
|
||||
RELEASE="v0.27.4"
|
||||
if check_for_gh_release "affine_app" "toeverything/AFFiNE" "${RELEASE}" "each release is tested individually before the version is updated. Please do not open issues for this"; then
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop affine-web affine-worker
|
||||
msg_ok "Stopped Services"
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop affine-web
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
ensure_dependencies cmake
|
||||
|
||||
create_backup /opt/affine/.env /root/.affine/config /root/.affine/storage
|
||||
create_backup /opt/affine/.env
|
||||
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "affine_app" "toeverything/AFFiNE" "tarball" "${RELEASE}" "/opt/affine"
|
||||
|
||||
@@ -55,14 +64,14 @@ function update_script() {
|
||||
msg_info "Rebuilding Application (Patience ~25 mins, don't close the console!)"
|
||||
cd /opt/affine
|
||||
source /root/.profile
|
||||
export PATH="/root/.cargo/bin:/root/.rbenv/shims:$PATH"
|
||||
export PATH="/root/.cargo/bin:$PATH"
|
||||
|
||||
set -a && source /opt/affine/.env && set +a
|
||||
|
||||
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||
export VITE_CORE_COMMIT_SHA=$(cat ~/.affine_app)
|
||||
|
||||
# Initialize git repo (required for build process)
|
||||
# The build needs a git repository
|
||||
export HUSKY=0
|
||||
$STD git init -q
|
||||
$STD git config user.email "build@local"
|
||||
@@ -70,7 +79,6 @@ function update_script() {
|
||||
$STD git add -A
|
||||
$STD git commit -q -m "update" --no-verify --allow-empty
|
||||
|
||||
# Force Turbo to run sequentially
|
||||
mkdir -p /opt/affine/.turbo
|
||||
cat <<TURBO >/opt/affine/.turbo/config.json
|
||||
{
|
||||
@@ -79,10 +87,9 @@ function update_script() {
|
||||
TURBO
|
||||
|
||||
$STD corepack enable
|
||||
$STD corepack prepare yarn@4.13.0 --activate
|
||||
$STD yarn config set enableTelemetry 0
|
||||
|
||||
export NODE_OPTIONS="--max-old-space-size=2048"
|
||||
export NODE_OPTIONS="--max-old-space-size=4096"
|
||||
$STD yarn install
|
||||
$STD bash ./scripts/set-version.sh "$(cat ~/.affine_app)"
|
||||
export BUILD_TYPE=stable
|
||||
@@ -102,8 +109,6 @@ TURBO
|
||||
$STD yarn affine init
|
||||
$STD yarn affine build -p @affine/reader
|
||||
$STD yarn affine build -p @affine/server
|
||||
|
||||
export NODE_OPTIONS="--max-old-space-size=4096"
|
||||
$STD yarn affine build -p @affine/web
|
||||
$STD yarn affine build -p @affine/admin
|
||||
|
||||
@@ -117,15 +122,16 @@ TURBO
|
||||
mkdir -p /opt/affine/packages/backend/server/static/mobile
|
||||
echo '{"publicPath":"/","js":[],"css":[],"gitHash":"","description":""}' \
|
||||
>/opt/affine/packages/backend/server/static/mobile/assets-manifest.json
|
||||
msg_ok "Rebuilt Application"
|
||||
|
||||
# Run migrations
|
||||
msg_info "Running Migrations"
|
||||
cd /opt/affine/packages/backend/server
|
||||
set -a && source /opt/affine/.env && set +a
|
||||
$STD node ./scripts/self-host-predeploy.js
|
||||
msg_ok "Ran Migrations"
|
||||
|
||||
msg_info "Starting Services"
|
||||
systemctl start affine-web affine-worker
|
||||
msg_ok "Started Services"
|
||||
msg_info "Starting Service"
|
||||
systemctl start affine-web
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Updated Successfully!"
|
||||
fi
|
||||
exit
|
||||
|
||||
@@ -60,6 +60,15 @@ update_deb_based() {
|
||||
|
||||
update_alpine() {
|
||||
$STD apk -U upgrade
|
||||
if [[ -f /root/.docker/cli-plugins/docker-compose ]]; then
|
||||
msg_info "Migrating Docker Compose to the Alpine package"
|
||||
if apk info -e docker-cli-compose &>/dev/null || $STD apk add docker-cli-compose; then
|
||||
rm -f /root/.docker/cli-plugins/docker-compose
|
||||
msg_ok "Migrated Docker Compose to the Alpine package ($(docker compose version --short))"
|
||||
else
|
||||
msg_warn "Could not install docker-cli-compose, keeping the old Compose binary"
|
||||
fi
|
||||
fi
|
||||
msg_ok "Updated successfully!"
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,16 @@ function update_script() {
|
||||
$STD apk -U upgrade
|
||||
msg_ok "System updated"
|
||||
|
||||
if [[ -f /root/.docker/cli-plugins/docker-compose ]]; then
|
||||
msg_info "Migrating Docker Compose to the Alpine package"
|
||||
if apk info -e docker-cli-compose &>/dev/null || $STD apk add docker-cli-compose; then
|
||||
rm -f /root/.docker/cli-plugins/docker-compose
|
||||
msg_ok "Migrated Docker Compose to the Alpine package"
|
||||
else
|
||||
msg_warn "Could not install docker-cli-compose, keeping the old Compose binary"
|
||||
fi
|
||||
fi
|
||||
|
||||
msg_info "Pulling latest NPMplus container image"
|
||||
cd /opt
|
||||
$STD docker compose pull
|
||||
|
||||
@@ -31,7 +31,7 @@ PG_DB_NAME="affine" PG_DB_USER="affine" setup_postgresql_db
|
||||
NODE_VERSION="22" setup_nodejs
|
||||
setup_rust
|
||||
|
||||
fetch_and_deploy_gh_release "affine_app" "toeverything/AFFiNE" "tarball" "v0.27.3" "/opt/affine"
|
||||
fetch_and_deploy_gh_release "affine_app" "toeverything/AFFiNE" "tarball" "v0.27.4" "/opt/affine"
|
||||
|
||||
msg_info "Setting up Directories"
|
||||
rm -rf /root/.affine
|
||||
@@ -59,7 +59,7 @@ source /root/.profile
|
||||
export PATH="/root/.cargo/bin:$PATH"
|
||||
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
|
||||
export VITE_CORE_COMMIT_SHA=$(cat ~/.affine_app)
|
||||
# # Initialize git repo (required for build process)
|
||||
# The build needs a git repository
|
||||
export HUSKY=0
|
||||
$STD git init -q
|
||||
$STD git config user.email "build@local"
|
||||
@@ -73,10 +73,8 @@ cat <<TURBO >/opt/affine/.turbo/config.json
|
||||
}
|
||||
TURBO
|
||||
$STD corepack enable
|
||||
$STD corepack prepare yarn@4.13.0 --activate
|
||||
$STD yarn config set enableTelemetry 0
|
||||
export NODE_OPTIONS="--max-old-space-size=4096"
|
||||
export TSC_COMPILE_ON_ERROR=true
|
||||
$STD yarn install
|
||||
$STD bash ./scripts/set-version.sh "$(cat ~/.affine_app)"
|
||||
export BUILD_TYPE=stable
|
||||
@@ -95,7 +93,6 @@ ln -sf /opt/affine/packages/backend/native/server-native.node \
|
||||
$STD yarn affine init
|
||||
$STD yarn affine build -p @affine/reader
|
||||
$STD yarn affine build -p @affine/server
|
||||
export NODE_OPTIONS="--max-old-space-size=4096"
|
||||
$STD yarn affine build -p @affine/web
|
||||
$STD yarn affine build -p @affine/admin
|
||||
mkdir -p /opt/affine/packages/backend/server/static
|
||||
@@ -135,28 +132,7 @@ RestartSec=10
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF >/etc/systemd/system/affine-worker.service
|
||||
[Unit]
|
||||
Description=AFFiNE Background Worker
|
||||
After=network.target postgresql.service redis-server.service
|
||||
Requires=postgresql.service redis-server.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/affine/packages/backend/server
|
||||
EnvironmentFile=/opt/affine/.env
|
||||
Environment=LD_PRELOAD=libjemalloc.so.2
|
||||
Environment=NODE_OPTIONS=--max-old-space-size=1024
|
||||
ExecStart=/usr/bin/node ./dist/main.js --worker
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl enable -q --now redis-server affine-web affine-worker
|
||||
systemctl enable -q --now redis-server affine-web
|
||||
msg_ok "Created Services"
|
||||
|
||||
msg_info "Creating Admin User"
|
||||
|
||||
@@ -66,16 +66,12 @@ setup_alpine() {
|
||||
$STD rc-update add docker default
|
||||
msg_ok "Installed Docker"
|
||||
|
||||
DOCKER_COMPOSE_LATEST_VERSION=$(get_latest_github_release "docker/compose" false)
|
||||
prompt="${var_docker_compose:-}"
|
||||
[[ -n "$prompt" ]] || read -r -p "${TAB3}Would you like to add Docker Compose? <y/N> " prompt || true
|
||||
if [[ "${prompt,,}" =~ ^(y|yes|true)$ ]]; then
|
||||
msg_info "Installing Docker Compose $DOCKER_COMPOSE_LATEST_VERSION"
|
||||
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
|
||||
mkdir -p "$DOCKER_CONFIG"/cli-plugins
|
||||
curl -fsSL https://github.com/docker/compose/releases/download/"$DOCKER_COMPOSE_LATEST_VERSION"/docker-compose-linux-$(arch_resolve "x86_64" "aarch64") -o ~/.docker/cli-plugins/docker-compose
|
||||
chmod +x "$DOCKER_CONFIG"/cli-plugins/docker-compose
|
||||
msg_ok "Installed Docker Compose $DOCKER_COMPOSE_LATEST_VERSION"
|
||||
msg_info "Installing Docker Compose"
|
||||
$STD apk add docker-cli-compose
|
||||
msg_ok "Installed Docker Compose $(docker compose version --short)"
|
||||
fi
|
||||
prompt="${var_docker_socket:-}"
|
||||
[[ -n "$prompt" ]] || read -r -p "${TAB3}Would you like to expose the Docker TCP socket? <y/N> " prompt || true
|
||||
|
||||
@@ -21,15 +21,9 @@ $STD apk add \
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
msg_info "Installing Docker & Compose"
|
||||
$STD apk add docker
|
||||
$STD apk add docker docker-cli-compose
|
||||
$STD rc-service docker start
|
||||
$STD rc-update add docker default
|
||||
|
||||
DOCKER_COMPOSE_LATEST_VERSION=$(get_latest_github_release "docker/compose" false)
|
||||
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
|
||||
mkdir -p $DOCKER_CONFIG/cli-plugins
|
||||
curl -fsSL https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_LATEST_VERSION/docker-compose-linux-$(arch_resolve "x86_64" "aarch64") -o ~/.docker/cli-plugins/docker-compose
|
||||
chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
|
||||
msg_ok "Installed Docker & Compose"
|
||||
|
||||
msg_info "Fetching NPMplus"
|
||||
|
||||
Reference in new issue
Block a user