Ensure manticore tables and mysql client

This commit is contained in:
Codex
2025-11-17 11:38:41 -06:00
parent 6b6d7af07d
commit 4e2825ffe2
6 changed files with 67 additions and 5 deletions

View File

@@ -13,14 +13,14 @@ cloudron build \
--set-build-service builder.docker.due.ren \ --set-build-service builder.docker.due.ren \
--build-service-token e3265de06b1d0e7bb38400539012a8433a74c2c96a17955e \ --build-service-token e3265de06b1d0e7bb38400539012a8433a74c2c96a17955e \
--set-repository andreasdueren/affine-cloudron \ --set-repository andreasdueren/affine-cloudron \
--tag 0.25.5-2 --tag 0.25.5-3
``` ```
## Deployment Steps ## Deployment Steps
1. Remove any previous dev install of AFFiNE on the Cloudron (always reinstall from scratch). 1. Remove any previous dev install of AFFiNE on the Cloudron (always reinstall from scratch).
2. Install the freshly built image: 2. Install the freshly built image:
```bash ```bash
cloudron install --location affine.due.ren --image andreasdueren/affine-cloudron:0.25.5-2 cloudron install --location affine.due.ren --image andreasdueren/affine-cloudron:0.25.5-3
``` ```
3. When prompted, confirm the app info and wait for Cloudron to report success (abort after ~30 seconds if installation stalls or errors to avoid hanging sessions). 3. When prompted, confirm the app info and wait for Cloudron to report success (abort after ~30 seconds if installation stalls or errors to avoid hanging sessions).
4. Visit `https://affine.due.ren` (or the chosen location) and sign in using Cloudron SSO. 4. Visit `https://affine.due.ren` (or the chosen location) and sign in using Cloudron SSO.

View File

@@ -5,9 +5,9 @@
"description": "Next-gen knowledge base that blends docs, whiteboards, and databases for self-hosted teams.", "description": "Next-gen knowledge base that blends docs, whiteboards, and databases for self-hosted teams.",
"website": "https://affine.pro", "website": "https://affine.pro",
"contactEmail": "support@affine.pro", "contactEmail": "support@affine.pro",
"version": "0.25.5-2", "version": "0.25.5-3",
"upstreamVersion": "0.25.5", "upstreamVersion": "0.25.5",
"changelog": "Add copilot.env.example sample and env overrides", "changelog": "Ensure Manticore tables exist and ship copilot env sample",
"icon": "file://icon.png", "icon": "file://icon.png",
"manifestVersion": 2, "manifestVersion": 2,
"minBoxVersion": "7.0.0", "minBoxVersion": "7.0.0",

View File

@@ -14,7 +14,7 @@ ENV APP_CODE_DIR=/app/code \
RUN mkdir -p "$APP_CODE_DIR" "$APP_DATA_DIR" "$APP_RUNTIME_DIR" "$APP_TMP_DIR" && \ RUN mkdir -p "$APP_CODE_DIR" "$APP_DATA_DIR" "$APP_RUNTIME_DIR" "$APP_TMP_DIR" && \
apt-get update && \ apt-get update && \
apt-get install -y --no-install-recommends jq python3 ca-certificates curl openssl libjemalloc2 postgresql-client && \ apt-get install -y --no-install-recommends jq python3 ca-certificates curl openssl libjemalloc2 postgresql-client mysql-client && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
RUN curl -fsSL https://repo.manticoresearch.com/GPG-KEY-manticore > /tmp/manticore.key && \ RUN curl -fsSL https://repo.manticoresearch.com/GPG-KEY-manticore > /tmp/manticore.key && \

24
manticore/block.sql Normal file
View File

@@ -0,0 +1,24 @@
CREATE TABLE IF NOT EXISTS block (
workspace_id string attribute,
doc_id string attribute,
block_id string attribute,
content text,
flavour string attribute,
flavour_indexed string attribute indexed,
blob string attribute indexed,
ref_doc_id string attribute indexed,
ref string stored,
parent_flavour string attribute,
parent_flavour_indexed string attribute indexed,
parent_block_id string attribute,
parent_block_id_indexed string attribute indexed,
additional string stored,
markdown_preview string stored,
created_by_user_id string attribute,
updated_by_user_id string attribute,
created_at timestamp,
updated_at timestamp
)
morphology = 'jieba_chinese, lemmatize_en_all, lemmatize_de_all, lemmatize_ru_all, libstemmer_ar, libstemmer_ca, stem_cz, libstemmer_da, libstemmer_nl, libstemmer_fi, libstemmer_fr, libstemmer_el, libstemmer_hi, libstemmer_hu, libstemmer_id, libstemmer_ga, libstemmer_it, libstemmer_lt, libstemmer_ne, libstemmer_no, libstemmer_pt, libstemmer_ro, libstemmer_es, libstemmer_sv, libstemmer_ta, libstemmer_tr'
charset_table = 'non_cjk, cjk'
index_field_lengths = '1';

14
manticore/doc.sql Normal file
View File

@@ -0,0 +1,14 @@
CREATE TABLE IF NOT EXISTS doc (
workspace_id string attribute,
doc_id string attribute,
title text,
summary string stored,
journal string stored,
created_by_user_id string attribute,
updated_by_user_id string attribute,
created_at timestamp,
updated_at timestamp
)
morphology = 'jieba_chinese, lemmatize_en_all, lemmatize_de_all, lemmatize_ru_all, libstemmer_ar, libstemmer_ca, stem_cz, libstemmer_da, libstemmer_nl, libstemmer_fi, libstemmer_fr, libstemmer_el, libstemmer_hi, libstemmer_hu, libstemmer_id, libstemmer_ga, libstemmer_it, libstemmer_lt, libstemmer_ne, libstemmer_no, libstemmer_pt, libstemmer_ro, libstemmer_es, libstemmer_sv, libstemmer_ta, libstemmer_tr'
charset_table = 'non_cjk, cjk'
index_field_lengths = '1';

View File

@@ -140,6 +140,29 @@ PY
fi fi
} }
seed_manticore_tables() {
local sql_dir="$APP_DIR/manticore"
if [ ! -d "$sql_dir" ]; then
return
fi
if ! command -v mysql >/dev/null 2>&1; then
log "mysql client not found; cannot seed Manticore tables"
return
fi
local mysql_cmd=(mysql -h 127.0.0.1 -P 9306)
for table in doc block; do
local sql_file="$sql_dir/${table}.sql"
if [ ! -f "$sql_file" ]; then
continue
fi
if "${mysql_cmd[@]}" < "$sql_file" >/dev/null 2>&1; then
log "Ensured Manticore table ${table}"
else
log "WARNING: Failed to apply ${sql_file} to Manticore"
fi
done
}
patch_upload_limits() { patch_upload_limits() {
local target="$APP_DIR/dist/main.js" local target="$APP_DIR/dist/main.js"
if [ ! -f "$target" ]; then if [ ! -f "$target" ]; then
@@ -270,6 +293,7 @@ NODE
log "Running AFFiNE pre-deployment migrations" log "Running AFFiNE pre-deployment migrations"
ensure_runtime_envs ensure_runtime_envs
wait_for_indexer wait_for_indexer
seed_manticore_tables
node ./scripts/self-host-predeploy.js node ./scripts/self-host-predeploy.js
patch_upload_limits patch_upload_limits
grant_team_plan_features grant_team_plan_features