This commit is contained in:
CanbiZ (MickLesk) 2026-01-21 12:35:08 +01:00
parent e449e68e7d
commit da9d8872dd
2 changed files with 8 additions and 24 deletions

View File

@ -132,4 +132,4 @@ description
msg_ok "Completed Successfully!\n" msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3010${CL}" echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3010/sign-in${CL}"

View File

@ -54,40 +54,32 @@ SECRET_KEY=${SECRET_KEY}
EOF EOF
msg_ok "Configured Environment" msg_ok "Configured Environment"
msg_info "Building AFFiNE (this will take 20-30 minutes)" msg_info "Building AFFiNE"
cd /opt/affine cd /opt/affine
source /root/.profile source /root/.profile
export PATH="/root/.cargo/bin:$PATH" export PATH="/root/.cargo/bin:$PATH"
set -a && source /opt/affine/.env && set +a set -a && source /opt/affine/.env && set +a
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0 export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
export VITE_CORE_COMMIT_SHA="v0.25.7" export VITE_CORE_COMMIT_SHA="v0.25.7"
# # Initialize git repo (required for build process)
# Initialize git repo (required for build process) # git init -q
git init -q # git config user.email "build@local"
git config user.email "build@local" # git config user.name "Build"
git config user.name "Build" # git add -A
git add -A # git commit -q -m "initial"
git commit -q -m "initial"
# Force Turbo to run sequentially
mkdir -p /opt/affine/.turbo mkdir -p /opt/affine/.turbo
cat <<TURBO >/opt/affine/.turbo/config.json cat <<TURBO >/opt/affine/.turbo/config.json
{ {
"concurrency": 1 "concurrency": 1
} }
TURBO TURBO
$STD corepack enable $STD corepack enable
$STD corepack prepare yarn@4.12.0 --activate $STD corepack prepare yarn@4.12.0 --activate
$STD yarn config set enableTelemetry 0 $STD yarn config set enableTelemetry 0
export NODE_OPTIONS="--max-old-space-size=4096" export NODE_OPTIONS="--max-old-space-size=4096"
export TSC_COMPILE_ON_ERROR=true export TSC_COMPILE_ON_ERROR=true
$STD yarn install $STD yarn install
# Make TypeScript available via npx/yarn exec
$STD npm install -g typescript $STD npm install -g typescript
$STD yarn affine @affine/native build $STD yarn affine @affine/native build
$STD yarn affine @affine/server-native build $STD yarn affine @affine/server-native build
@ -100,25 +92,17 @@ ln -sf /opt/affine/packages/backend/native/server-native.node \
/opt/affine/packages/backend/native/server-native.armv7.node /opt/affine/packages/backend/native/server-native.armv7.node
$STD yarn affine init $STD yarn affine init
msg_info "Building packages sequentially (this takes a while)"
$STD yarn affine build -p @affine/reader $STD yarn affine build -p @affine/reader
$STD yarn affine build -p @affine/server $STD yarn affine build -p @affine/server
# Web build needs more memory
export NODE_OPTIONS="--max-old-space-size=4096" export NODE_OPTIONS="--max-old-space-size=4096"
$STD yarn affine build -p @affine/web $STD yarn affine build -p @affine/web
# Copy web assets to server static directory
mkdir -p /opt/affine/packages/backend/server/static mkdir -p /opt/affine/packages/backend/server/static
cp -r /opt/affine/packages/frontend/apps/web/dist/* /opt/affine/packages/backend/server/static/ cp -r /opt/affine/packages/frontend/apps/web/dist/* /opt/affine/packages/backend/server/static/
# Create empty mobile manifest (server expects it but we don't build mobile) # Create empty mobile manifest (server expects it but we don't build mobile)
mkdir -p /opt/affine/packages/backend/server/static/mobile mkdir -p /opt/affine/packages/backend/server/static/mobile
cat <<'MANIFEST' >/opt/affine/packages/backend/server/static/mobile/assets-manifest.json cat <<'MANIFEST' >/opt/affine/packages/backend/server/static/mobile/assets-manifest.json
{"publicPath":"/","js":[],"css":[],"gitHash":"","description":""} {"publicPath":"/","js":[],"css":[],"gitHash":"","description":""}
MANIFEST MANIFEST
# Copy selfhost.html to admin directory # Copy selfhost.html to admin directory
mkdir -p /opt/affine/packages/backend/server/static/admin mkdir -p /opt/affine/packages/backend/server/static/admin
cp /opt/affine/packages/backend/server/static/selfhost.html \ cp /opt/affine/packages/backend/server/static/selfhost.html \