Update Anytype to use external MongoDB and Redis Stack

Switches Anytype deployment to use external MongoDB and Redis Stack instead of embedded databases. Updates default resources to 4GB RAM, 16GB disk, Ubuntu 24.04, and configures MongoDB replica set and Redis Stack installation. Adjusts service dependencies and environment variables accordingly.
This commit is contained in:
CanbiZ (MickLesk) 2026-01-29 10:36:57 +01:00
parent a5096a5b62
commit 210b6080cd
3 changed files with 39 additions and 16 deletions

View File

@ -8,10 +8,10 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
APP="Anytype" APP="Anytype"
var_tags="${var_tags:-notes;productivity;sync}" var_tags="${var_tags:-notes;productivity;sync}"
var_cpu="${var_cpu:-2}" var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}" var_ram="${var_ram:-4096}"
var_disk="${var_disk:-10}" var_disk="${var_disk:-16}"
var_os="${var_os:-debian}" var_os="${var_os:-ubuntu}"
var_version="${var_version:-13}" var_version="${var_version:-24.04}"
var_unprivileged="${var_unprivileged:-1}" var_unprivileged="${var_unprivileged:-1}"
header_info "$APP" header_info "$APP"

View File

@ -13,17 +13,17 @@
"website": "https://anytype.io/", "website": "https://anytype.io/",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/anytype.webp", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/anytype.webp",
"config_path": "/opt/anytype/.env", "config_path": "/opt/anytype/.env",
"description": "Anytype is a local-first, privacy-focused alternative to Notion. This script deploys the any-sync-bundle which provides a self-hosted sync server for Anytype clients with embedded MongoDB and Redis.", "description": "Anytype is a local-first, privacy-focused alternative to Notion. This script deploys the any-sync-bundle which provides a self-hosted sync server for Anytype clients with external MongoDB and Redis Stack.",
"install_methods": [ "install_methods": [
{ {
"type": "default", "type": "default",
"script": "ct/anytype.sh", "script": "ct/anytype.sh",
"resources": { "resources": {
"cpu": 2, "cpu": 2,
"ram": 2048, "ram": 4096,
"hdd": 10, "hdd": 16,
"os": "Debian", "os": "Ubuntu",
"version": "13" "version": "24.04"
} }
} }
], ],

View File

@ -13,21 +13,43 @@ setting_up_container
network_check network_check
update_os update_os
msg_info "Installing Dependencies" setup_mongodb
$STD apt install -y ca-certificates
msg_ok "Installed Dependencies" msg_info "Configuring MongoDB Replica Set"
cat <<EOF >>/etc/mongod.conf
replication:
replSetName: "rs0"
EOF
systemctl restart mongod
sleep 3
$STD mongosh --eval 'rs.initiate({_id: "rs0", members: [{_id: 0, host: "127.0.0.1:27017"}]})'
msg_ok "Configured MongoDB Replica Set"
msg_info "Installing Redis Stack"
setup_deb822_repo \
"redis-stack" \
"https://packages.redis.io/gpg" \
"https://packages.redis.io/deb" \
"jammy" \
"main"
$STD apt-get install -y \
redis-stack-server
systemctl enable -q --now redis-stack-server
msg_ok "Installed Redis Stack"
fetch_and_deploy_gh_release "anytype" "grishy/any-sync-bundle" "prebuild" "latest" "/opt/anytype" "any-sync-bundle_*_linux_amd64.tar.gz" fetch_and_deploy_gh_release "anytype" "grishy/any-sync-bundle" "prebuild" "latest" "/opt/anytype" "any-sync-bundle_*_linux_amd64.tar.gz"
chmod +x /opt/anytype/any-sync-bundle chmod +x /opt/anytype/any-sync-bundle
msg_info "Configuring Anytype" msg_info "Configuring Anytype"
mkdir -p /opt/anytype/data mkdir -p /opt/anytype/data/storage
cat <<EOF >/opt/anytype/.env cat <<EOF >/opt/anytype/.env
ANY_SYNC_BUNDLE_CONFIG=/opt/anytype/data/bundle-config.yml ANY_SYNC_BUNDLE_CONFIG=/opt/anytype/data/bundle-config.yml
ANY_SYNC_BUNDLE_CLIENT_CONFIG=/opt/anytype/data/client-config.yml ANY_SYNC_BUNDLE_CLIENT_CONFIG=/opt/anytype/data/client-config.yml
ANY_SYNC_BUNDLE_INIT_STORAGE=/opt/anytype/data/storage/ ANY_SYNC_BUNDLE_INIT_STORAGE=/opt/anytype/data/storage/
ANY_SYNC_BUNDLE_INIT_EXTERNAL_ADDRS=${LOCAL_IP} ANY_SYNC_BUNDLE_INIT_EXTERNAL_ADDRS=${LOCAL_IP}
ANY_SYNC_BUNDLE_INIT_MONGO_URI=mongodb://127.0.0.1:27017/
ANY_SYNC_BUNDLE_INIT_REDIS_URI=redis://127.0.0.1:6379/
ANY_SYNC_BUNDLE_LOG_LEVEL=info ANY_SYNC_BUNDLE_LOG_LEVEL=info
EOF EOF
msg_ok "Configured Anytype" msg_ok "Configured Anytype"
@ -36,15 +58,16 @@ msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/anytype.service cat <<EOF >/etc/systemd/system/anytype.service
[Unit] [Unit]
Description=Anytype Sync Server (any-sync-bundle) Description=Anytype Sync Server (any-sync-bundle)
After=network-online.target After=network-online.target mongod.service redis-stack-server.service
Wants=network-online.target Wants=network-online.target
Requires=mongod.service redis-stack-server.service
[Service] [Service]
Type=simple Type=simple
User=root User=root
WorkingDirectory=/opt/anytype WorkingDirectory=/opt/anytype
EnvironmentFile=/opt/anytype/.env EnvironmentFile=/opt/anytype/.env
ExecStart=/opt/anytype/any-sync-bundle start-all-in-one ExecStart=/opt/anytype/any-sync-bundle start-bundle
Restart=on-failure Restart=on-failure
RestartSec=10 RestartSec=10