mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-04-27 18:30:17 +00:00
Element Synapse: Add Synapse-Admin web UI to manage Matrix (#4010)
* Update script * Update
This commit is contained in:
parent
fb3d0b24c7
commit
de89dd90cc
@ -27,10 +27,44 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
if [[ ! -f /opt/"${APP}"_version.txt ]]; then
|
||||||
|
touch /opt/"${APP}"_version.txt
|
||||||
|
fi
|
||||||
|
if ! dpkg -l | grep -q '^ii.*gpg'; then
|
||||||
|
$STD apt-get update
|
||||||
|
$STD apt-get install -y gpg
|
||||||
|
fi
|
||||||
|
if [[ ! -x /usr/bin/node ]]; then
|
||||||
|
mkdir -p /etc/apt/keyrings
|
||||||
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||||
|
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
|
||||||
|
$STD apt-get update
|
||||||
|
$STD apt-get install -y nodejs
|
||||||
|
$STD npm install -g yarn
|
||||||
|
fi
|
||||||
msg_info "Updating $APP LXC"
|
msg_info "Updating $APP LXC"
|
||||||
$STD apt-get update
|
$STD apt-get update
|
||||||
$STD apt-get -y upgrade
|
$STD apt-get -y upgrade
|
||||||
msg_ok "Updated $APP LXC"
|
msg_ok "Updated $APP LXC"
|
||||||
|
|
||||||
|
msg_info "Updating Synapse-Admin"
|
||||||
|
RELEASE=$(curl -fsSL https://api.github.com/repos/etkecc/synapse-admin/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
if [[ "${RELEASE}" != "$(cat /opt/"${APP}"_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||||
|
temp_file=$(mktemp)
|
||||||
|
systemctl stop synapse-admin
|
||||||
|
rm -rf /opt/synapse-admin
|
||||||
|
mkdir -p /opt/synapse-admin
|
||||||
|
curl -fsSL "https://github.com/etkecc/synapse-admin/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
||||||
|
tar xzf "$temp_file" -C /opt/synapse-admin
|
||||||
|
cd /opt/synapse-admin
|
||||||
|
$STD yarn install --ignore-engines
|
||||||
|
systemctl start synapse-admin
|
||||||
|
echo "${RELEASE}" >/opt/"${APP}"_version.txt
|
||||||
|
rm -f "$temp_file"
|
||||||
|
msg_ok "Update Successful"
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
|
fi
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,5 +30,14 @@
|
|||||||
"username": null,
|
"username": null,
|
||||||
"password": null
|
"password": null
|
||||||
},
|
},
|
||||||
"notes": []
|
"notes": [
|
||||||
|
{
|
||||||
|
"type": "info",
|
||||||
|
"text": "Type `cat ~/matrix.creds` to see admin username/password."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "info",
|
||||||
|
"text": "Synapse-Admin is running on port 5173"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
@ -17,9 +17,22 @@ msg_info "Installing Dependencies"
|
|||||||
$STD apt-get install -y \
|
$STD apt-get install -y \
|
||||||
lsb-release \
|
lsb-release \
|
||||||
apt-transport-https \
|
apt-transport-https \
|
||||||
debconf-utils
|
debconf-utils \
|
||||||
|
gpg
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
msg_info "Setting up Node.js Repository"
|
||||||
|
mkdir -p /etc/apt/keyrings
|
||||||
|
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
|
||||||
|
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
|
||||||
|
msg_ok "Set up Node.js Repository"
|
||||||
|
|
||||||
|
msg_info "Installing Node.js"
|
||||||
|
$STD apt-get update
|
||||||
|
$STD apt-get install -y nodejs
|
||||||
|
$STD npm install -g yarn
|
||||||
|
msg_ok "Installed Node.js"
|
||||||
|
|
||||||
read -p "Please enter the name for your server: " servername
|
read -p "Please enter the name for your server: " servername
|
||||||
|
|
||||||
msg_info "Installing Element Synapse"
|
msg_info "Installing Element Synapse"
|
||||||
@ -32,9 +45,48 @@ $STD apt-get install matrix-synapse-py3 -y
|
|||||||
systemctl stop matrix-synapse
|
systemctl stop matrix-synapse
|
||||||
sed -i 's/127.0.0.1/0.0.0.0/g' /etc/matrix-synapse/homeserver.yaml
|
sed -i 's/127.0.0.1/0.0.0.0/g' /etc/matrix-synapse/homeserver.yaml
|
||||||
sed -i 's/'\''::1'\'', //g' /etc/matrix-synapse/homeserver.yaml
|
sed -i 's/'\''::1'\'', //g' /etc/matrix-synapse/homeserver.yaml
|
||||||
|
SECRET=$(openssl rand -hex 32)
|
||||||
|
ADMIN_PASS="$(openssl rand -base64 18 | cut -c1-13)"
|
||||||
|
echo "enable_registration_without_verification: true" >>/etc/matrix-synapse/homeserver.yaml
|
||||||
|
echo "registration_shared_secret: ${SECRET}" >>/etc/matrix-synapse/homeserver.yaml
|
||||||
systemctl enable -q --now matrix-synapse
|
systemctl enable -q --now matrix-synapse
|
||||||
|
$STD register_new_matrix_user -a --user admin --password "$ADMIN_PASS" --config /etc/matrix-synapse/homeserver.yaml
|
||||||
|
{
|
||||||
|
echo "Matrix-Credentials"
|
||||||
|
echo "Admin username: admin"
|
||||||
|
echo "Admin password: $ADMIN_PASS"
|
||||||
|
} >>~/matrix.creds
|
||||||
|
systemctl stop matrix-synapse
|
||||||
|
sed -i '34d' /etc/matrix-synapse/homeserver.yaml
|
||||||
|
systemctl start matrix-synapse
|
||||||
|
temp_file=$(mktemp)
|
||||||
|
mkdir -p /opt/synapse-admin
|
||||||
|
RELEASE=$(curl -fsSL https://api.github.com/repos/etkecc/synapse-admin/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
|
curl -fsSL "https://github.com/etkecc/synapse-admin/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
|
||||||
|
tar xzf "$temp_file" -C /opt/synapse-admin
|
||||||
|
cd /opt/synapse-admin
|
||||||
|
$STD yarn install --ignore-engines
|
||||||
msg_ok "Installed Element Synapse"
|
msg_ok "Installed Element Synapse"
|
||||||
|
|
||||||
|
msg_info "Creating Service"
|
||||||
|
cat <<EOF >/etc/systemd/system/synapse-admin.service
|
||||||
|
[Unit]
|
||||||
|
Description=Excalidraw Service
|
||||||
|
After=network.target
|
||||||
|
Requires=matrix-synapse.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
WorkingDirectory=/opt/synapse-admin
|
||||||
|
ExecStart=/usr/bin/yarn start --host
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
systemctl enable -q --now synapse-admin
|
||||||
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user