Skip to content

Commit b8ba409

Browse files
authored
Element Synapse: switched from development to production mode and fixed update (#5066)
* Update elementsynapse.sh * Update elementsynapse-install.sh * Update elementsynapse.sh removed comment
1 parent 7cf8300 commit b8ba409

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

ct/elementsynapse.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function update_script() {
4747
$STD apt-get -y upgrade
4848
msg_ok "Updated $APP LXC"
4949

50-
if [[ -f /systemd/system/synapse-admin.service ]]; then
50+
if [[ -f /etc/systemd/system/synapse-admin.service ]]; then
5151
msg_info "Updating Synapse-Admin"
5252
RELEASE=$(curl -fsSL https://api.github.com/repos/etkecc/synapse-admin/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
5353
if [[ "${RELEASE}" != "$(cat /opt/"${APP}"_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
@@ -58,7 +58,16 @@ function update_script() {
5858
curl -fsSL "https://github.com/etkecc/synapse-admin/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
5959
tar xzf "$temp_file" -C /opt/synapse-admin --strip-components=1
6060
cd /opt/synapse-admin
61+
$STD yarn global add serve
6162
$STD yarn install --ignore-engines
63+
$STD yarn build
64+
mv ./dist ../ && \
65+
rm -rf * && \
66+
mv ../dist ./
67+
if [[ -z $(grep "ExecStart=/usr/local/bin/serve" /etc/systemd/system/synapse-admin.service) ]]; then
68+
sed -i 's|^ExecStart=.*|ExecStart=/usr/local/bin/serve -s dist -l 5173|' /etc/systemd/system/synapse-admin.service
69+
systemctl reenable synapse-admin
70+
fi
6271
systemctl start synapse-admin
6372
echo "${RELEASE}" >/opt/"${APP}"_version.txt
6473
rm -f "$temp_file"

install/elementsynapse-install.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ RELEASE=$(curl -fsSL https://api.github.com/repos/etkecc/synapse-admin/releases/
5454
curl -fsSL "https://github.com/etkecc/synapse-admin/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
5555
tar xzf "$temp_file" -C /opt/synapse-admin --strip-components=1
5656
cd /opt/synapse-admin
57+
$STD yarn global add serve
5758
$STD yarn install --ignore-engines
59+
$STD yarn build
60+
mv ./dist ../ && \
61+
rm -rf * && \
62+
mv ../dist ./
5863
msg_ok "Installed Element Synapse"
5964

6065
msg_info "Creating Service"
@@ -67,7 +72,7 @@ Requires=matrix-synapse.service
6772
[Service]
6873
Type=simple
6974
WorkingDirectory=/opt/synapse-admin
70-
ExecStart=/usr/bin/yarn start --host
75+
ExecStart=/usr/local/bin/serve -s dist -l 5173
7176
Restart=always
7277
7378
[Install]

0 commit comments

Comments
 (0)