Enable LTO, switch to corepack and update services
Enable thin LTO for backend builds by setting CARGO_PROFILE_RELEASE_LTO=thin when running cargo build. Replace global npm pnpm install with corepack enable + corepack prepare pnpm@11.3.0 to manage pnpm (previously pnpm@10.28.1). Adjust Nginx upstream locations to use non-trailing-slash location blocks and add proxy_redirect rules for /api, /autumn, and /january to preserve paths. Rename service binaries to revolt-* (revolt-delta, revolt-bonfire, revolt-autumn, revolt-january, revolt-crond) and add mongod, redis-server, and rabbitmq-server to systemd After= dependencies so services start after required DB/queue components.
This commit is contained in:
@@ -43,6 +43,7 @@ function update_script() {
|
|||||||
|
|
||||||
msg_info "Rebuilding Backend (Patience)"
|
msg_info "Rebuilding Backend (Patience)"
|
||||||
cd /opt/stoatchat
|
cd /opt/stoatchat
|
||||||
|
CARGO_PROFILE_RELEASE_LTO=thin \
|
||||||
$STD cargo build --release --bins -j 2
|
$STD cargo build --release --bins -j 2
|
||||||
msg_ok "Rebuilt Backend"
|
msg_ok "Rebuilt Backend"
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ msg_ok "Built Backend"
|
|||||||
NODE_VERSION="22" setup_nodejs
|
NODE_VERSION="22" setup_nodejs
|
||||||
|
|
||||||
msg_info "Installing pnpm"
|
msg_info "Installing pnpm"
|
||||||
$STD npm install -g pnpm@10.28.1
|
$STD corepack enable pnpm
|
||||||
|
$STD corepack prepare pnpm@11.3.0 --activate
|
||||||
msg_ok "Installed pnpm"
|
msg_ok "Installed pnpm"
|
||||||
|
|
||||||
msg_info "Cloning Web Frontend"
|
msg_info "Cloning Web Frontend"
|
||||||
@@ -182,11 +183,12 @@ server {
|
|||||||
|
|
||||||
client_max_body_size 20M;
|
client_max_body_size 20M;
|
||||||
|
|
||||||
location /api/ {
|
location /api {
|
||||||
proxy_pass http://127.0.0.1:14702/;
|
proxy_pass http://127.0.0.1:14702/;
|
||||||
proxy_set_header Host \$host;
|
proxy_set_header Host \$host;
|
||||||
proxy_set_header X-Real-IP \$remote_addr;
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
|
proxy_redirect / /api/;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /ws {
|
location /ws {
|
||||||
@@ -198,18 +200,20 @@ server {
|
|||||||
proxy_set_header X-Real-IP \$remote_addr;
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /autumn/ {
|
location /autumn {
|
||||||
proxy_pass http://127.0.0.1:14704/;
|
proxy_pass http://127.0.0.1:14704/;
|
||||||
proxy_set_header Host \$host;
|
proxy_set_header Host \$host;
|
||||||
proxy_set_header X-Real-IP \$remote_addr;
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
|
proxy_redirect / /autumn/;
|
||||||
}
|
}
|
||||||
|
|
||||||
location /january/ {
|
location /january {
|
||||||
proxy_pass http://127.0.0.1:14705/;
|
proxy_pass http://127.0.0.1:14705/;
|
||||||
proxy_set_header Host \$host;
|
proxy_set_header Host \$host;
|
||||||
proxy_set_header X-Real-IP \$remote_addr;
|
proxy_set_header X-Real-IP \$remote_addr;
|
||||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||||
|
proxy_redirect / /january/;
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
@@ -229,29 +233,29 @@ for SVC in api events autumn january crond; do
|
|||||||
case $SVC in
|
case $SVC in
|
||||||
api)
|
api)
|
||||||
PORT=14702
|
PORT=14702
|
||||||
BIN=delta
|
BIN=revolt-delta
|
||||||
;;
|
;;
|
||||||
events)
|
events)
|
||||||
PORT=14703
|
PORT=14703
|
||||||
BIN=bonfire
|
BIN=revolt-bonfire
|
||||||
;;
|
;;
|
||||||
autumn)
|
autumn)
|
||||||
PORT=14704
|
PORT=14704
|
||||||
BIN=autumn
|
BIN=revolt-autumn
|
||||||
;;
|
;;
|
||||||
january)
|
january)
|
||||||
PORT=14705
|
PORT=14705
|
||||||
BIN=january
|
BIN=revolt-january
|
||||||
;;
|
;;
|
||||||
crond)
|
crond)
|
||||||
PORT=0
|
PORT=0
|
||||||
BIN=crond
|
BIN=revolt-crond
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
cat <<EOF >/etc/systemd/system/stoatchat-${SVC}.service
|
cat <<EOF >/etc/systemd/system/stoatchat-${SVC}.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Stoatchat ${SVC} service
|
Description=Stoatchat ${SVC} service
|
||||||
After=network.target garage.service
|
After=network.target mongod.service redis-server.service rabbitmq-server.service garage.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
|||||||
Reference in New Issue
Block a user