mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-04-27 09:30:18 +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
@ -20,18 +20,52 @@ color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /etc/matrix-synapse ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
msg_info "Updating $APP LXC"
|
||||
$STD apt-get update
|
||||
$STD apt-get -y upgrade
|
||||
msg_ok "Updated $APP LXC"
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
if [[ ! -d /etc/matrix-synapse ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
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"
|
||||
$STD apt-get update
|
||||
$STD apt-get -y upgrade
|
||||
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
|
||||
}
|
||||
|
||||
start
|
||||
@ -41,4 +75,4 @@ description
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8008${CL}"
|
||||
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8008${CL}"
|
||||
|
@ -1,34 +1,43 @@
|
||||
{
|
||||
"name": "Element Synapse",
|
||||
"slug": "elementsynapse",
|
||||
"categories": [
|
||||
4
|
||||
],
|
||||
"date_created": "2025-02-02",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 8008,
|
||||
"documentation": "https://element-hq.github.io/synapse/latest/welcome_and_overview.html",
|
||||
"website": "https://element.io/",
|
||||
"logo": "https://element.io/images/logo-mark-primary.svg",
|
||||
"description": "Synapse is an open source Matrix homeserver implementation, written and maintained by Element. Matrix is the open standard for secure and interoperable real time communications. You can directly run and manage the source code in this repository, available under an AGPL license. There is no support provided from Element unless you have a subscription.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/elementsynapse.sh",
|
||||
"resources": {
|
||||
"cpu": 1,
|
||||
"ram": 1024,
|
||||
"hdd": 4,
|
||||
"os": "debian",
|
||||
"version": "12"
|
||||
}
|
||||
"name": "Element Synapse",
|
||||
"slug": "elementsynapse",
|
||||
"categories": [
|
||||
4
|
||||
],
|
||||
"date_created": "2025-02-02",
|
||||
"type": "ct",
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 8008,
|
||||
"documentation": "https://element-hq.github.io/synapse/latest/welcome_and_overview.html",
|
||||
"website": "https://element.io/",
|
||||
"logo": "https://element.io/images/logo-mark-primary.svg",
|
||||
"description": "Synapse is an open source Matrix homeserver implementation, written and maintained by Element. Matrix is the open standard for secure and interoperable real time communications. You can directly run and manage the source code in this repository, available under an AGPL license. There is no support provided from Element unless you have a subscription.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/elementsynapse.sh",
|
||||
"resources": {
|
||||
"cpu": 1,
|
||||
"ram": 1024,
|
||||
"hdd": 4,
|
||||
"os": "debian",
|
||||
"version": "12"
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
}
|
||||
],
|
||||
"default_credentials": {
|
||||
"username": null,
|
||||
"password": null
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"type": "info",
|
||||
"text": "Type `cat ~/matrix.creds` to see admin username/password."
|
||||
},
|
||||
"notes": []
|
||||
}
|
||||
{
|
||||
"type": "info",
|
||||
"text": "Synapse-Admin is running on port 5173"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -17,9 +17,22 @@ msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y \
|
||||
lsb-release \
|
||||
apt-transport-https \
|
||||
debconf-utils
|
||||
debconf-utils \
|
||||
gpg
|
||||
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
|
||||
|
||||
msg_info "Installing Element Synapse"
|
||||
@ -32,9 +45,48 @@ $STD apt-get install matrix-synapse-py3 -y
|
||||
systemctl stop matrix-synapse
|
||||
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
|
||||
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
|
||||
$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_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
|
||||
customize
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user