Skip to content

Commit c55d078

Browse files
Anytype-Server (#12974)
Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com>
1 parent 2080603 commit c55d078

2 files changed

Lines changed: 148 additions & 0 deletions

File tree

ct/anytype-server.sh

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
4+
# Copyright (c) 2021-2026 community-scripts ORG
5+
# Author: MickLesk (CanbiZ)
6+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
# Source: https://anytype.io
8+
9+
APP="Anytype-Server"
10+
var_tags="${var_tags:-notes;productivity;sync}"
11+
var_cpu="${var_cpu:-2}"
12+
var_ram="${var_ram:-4096}"
13+
var_disk="${var_disk:-16}"
14+
var_os="${var_os:-ubuntu}"
15+
var_version="${var_version:-24.04}"
16+
var_unprivileged="${var_unprivileged:-1}"
17+
18+
header_info "$APP"
19+
variables
20+
color
21+
catch_errors
22+
23+
function update_script() {
24+
header_info
25+
check_container_storage
26+
check_container_resources
27+
28+
if [[ ! -f /opt/anytype/any-sync-bundle ]]; then
29+
msg_error "No ${APP} Installation Found!"
30+
exit
31+
fi
32+
33+
if check_for_gh_release "anytype" "grishy/any-sync-bundle"; then
34+
msg_info "Stopping Service"
35+
systemctl stop anytype
36+
msg_ok "Stopped Service"
37+
38+
msg_info "Backing up Data"
39+
cp -r /opt/anytype/data /opt/anytype_data_backup
40+
msg_ok "Backed up Data"
41+
42+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "anytype" "grishy/any-sync-bundle" "prebuild" "latest" "/opt/anytype" "any-sync-bundle_*_linux_amd64.tar.gz"
43+
chmod +x /opt/anytype/any-sync-bundle
44+
45+
msg_info "Restoring Data"
46+
cp -r /opt/anytype_data_backup/. /opt/anytype/data
47+
rm -rf /opt/anytype_data_backup
48+
msg_ok "Restored Data"
49+
50+
msg_info "Starting Service"
51+
systemctl start anytype
52+
msg_ok "Started Service"
53+
msg_ok "Updated successfully!"
54+
fi
55+
exit
56+
}
57+
58+
start
59+
build_container
60+
description
61+
62+
msg_ok "Completed Successfully!\n"
63+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
64+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
65+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:33010${CL}"
66+
echo -e "${INFO}${YW} Client config file:${CL}"
67+
echo -e "${TAB}${GATEWAY}${BGN}/opt/anytype/data/client-config.yml${CL}"

install/anytype-server-install.sh

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://anytype.io
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
setup_mongodb
17+
18+
msg_info "Configuring MongoDB Replica Set"
19+
cat <<EOF >>/etc/mongod.conf
20+
21+
replication:
22+
replSetName: "rs0"
23+
EOF
24+
systemctl restart mongod
25+
sleep 3
26+
$STD mongosh --eval 'rs.initiate({_id: "rs0", members: [{_id: 0, host: "127.0.0.1:27017"}]})'
27+
msg_ok "Configured MongoDB Replica Set"
28+
29+
msg_info "Installing Redis Stack"
30+
setup_deb822_repo \
31+
"redis-stack" \
32+
"https://packages.redis.io/gpg" \
33+
"https://packages.redis.io/deb" \
34+
"jammy" \
35+
"main"
36+
$STD apt install -y redis-stack-server
37+
systemctl enable -q --now redis-stack-server
38+
msg_ok "Installed Redis Stack"
39+
40+
fetch_and_deploy_gh_release "anytype" "grishy/any-sync-bundle" "prebuild" "latest" "/opt/anytype" "any-sync-bundle_*_linux_amd64.tar.gz"
41+
chmod +x /opt/anytype/any-sync-bundle
42+
43+
msg_info "Configuring Anytype"
44+
mkdir -p /opt/anytype/data/storage
45+
cat <<EOF >/opt/anytype/.env
46+
ANY_SYNC_BUNDLE_CONFIG=/opt/anytype/data/bundle-config.yml
47+
ANY_SYNC_BUNDLE_CLIENT_CONFIG=/opt/anytype/data/client-config.yml
48+
ANY_SYNC_BUNDLE_INIT_STORAGE=/opt/anytype/data/storage/
49+
ANY_SYNC_BUNDLE_INIT_EXTERNAL_ADDRS=${LOCAL_IP}
50+
ANY_SYNC_BUNDLE_INIT_MONGO_URI=mongodb://127.0.0.1:27017/
51+
ANY_SYNC_BUNDLE_INIT_REDIS_URI=redis://127.0.0.1:6379/
52+
ANY_SYNC_BUNDLE_LOG_LEVEL=info
53+
EOF
54+
msg_ok "Configured Anytype"
55+
56+
msg_info "Creating Service"
57+
cat <<EOF >/etc/systemd/system/anytype.service
58+
[Unit]
59+
Description=Anytype Sync Server (any-sync-bundle)
60+
After=network-online.target mongod.service redis-stack-server.service
61+
Wants=network-online.target
62+
Requires=mongod.service redis-stack-server.service
63+
64+
[Service]
65+
Type=simple
66+
User=root
67+
WorkingDirectory=/opt/anytype
68+
EnvironmentFile=/opt/anytype/.env
69+
ExecStart=/opt/anytype/any-sync-bundle start-bundle
70+
Restart=on-failure
71+
RestartSec=10
72+
73+
[Install]
74+
WantedBy=multi-user.target
75+
EOF
76+
systemctl enable -q --now anytype
77+
msg_ok "Created Service"
78+
79+
motd_ssh
80+
customize
81+
cleanup_lxc

0 commit comments

Comments
 (0)