[Fix] Sure: add Sidekiq service (#12186)

This commit is contained in:
Chris
2026-02-22 12:55:41 -05:00
committed by GitHub
parent a8bec558f9
commit 85502e7c43
2 changed files with 61 additions and 9 deletions

View File

@@ -30,9 +30,38 @@ function update_script() {
fi
if check_for_gh_release "Sure" "we-promise/sure"; then
msg_info "Stopping Service"
$STD systemctl stop sure
msg_ok "Stopped Service"
if [[ ! -f /etc/systemd/system/sure-worker.service ]]; then
cat <<EOF >/etc/systemd/system/sure-worker.service
[Unit]
Description=Sure Background Worker (Sidekiq)
After=network.target redis-server.service
[Service]
Type=simple
WorkingDirectory=/opt/sure
Environment=RAILS_ENV=production
Environment=BUNDLE_DEPLOYMENT=1
Environment=BUNDLE_WITHOUT=development
Environment=PATH=/root/.rbenv/shims:/root/.rbenv/bin:/usr/bin:/usr/local/bin:/sbin:/bin
EnvironmentFile=/etc/sure/.env
ExecStart=/opt/sure/bin/bundle exec sidekiq -e production
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q sure-worker
msg_info "Stopping Service"
$STD systemctl stop sure
msg_ok "Stopped Service"
else
msg_info "Stopping services"
$STD systemctl stop sure-worker sure
msg_ok "Stopped services"
fi
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "Sure" "we-promise/sure" "tarball" "latest" "/opt/sure"
RUBY_VERSION="$(cat /opt/sure/.ruby-version)" RUBY_INSTALL_RAILS=false setup_ruby
@@ -50,9 +79,9 @@ function update_script() {
unset SECRET_KEY_BASE_DUMMY
msg_ok "Updated Sure"
msg_info "Starting Service"
$STD systemctl start sure
msg_ok "Started Service"
msg_info "Starting Services"
$STD systemctl start sure sure-worker
msg_ok "Started Services"
msg_ok "Updated successfully!"
fi
exit

View File

@@ -55,7 +55,7 @@ POSTGRES_DB=${PG_DB_NAME}/" \
-e "s|^APP_DOMAIN=|&${LOCAL_IP}|" /etc/sure/.env
msg_ok "Configured Sure"
msg_info "Creating Service"
msg_info "Creating Services"
cat <<EOF >/etc/systemd/system/sure.service
[Unit]
Description=Sure Service
@@ -79,8 +79,31 @@ StandardError=journal
[Install]
WantedBy=multi-user.target
EOF
$STD systemctl enable -q --now sure
msg_ok "Created Service"
cat <<EOF >/etc/systemd/system/sure-worker.service
[Unit]
Description=Sure Background Worker (Sidekiq)
After=network.target redis-server.service
[Service]
Type=simple
WorkingDirectory=/opt/sure
Environment=RAILS_ENV=production
Environment=BUNDLE_DEPLOYMENT=1
Environment=BUNDLE_WITHOUT=development
Environment=PATH=/root/.rbenv/shims:/root/.rbenv/bin:/usr/bin:/usr/local/bin:/sbin:/bin
EnvironmentFile=/etc/sure/.env
ExecStart=/opt/sure/bin/bundle exec sidekiq -e production
Restart=always
RestartSec=5
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
EOF
$STD systemctl enable -q --now sure sure-worker
msg_ok "Created Services"
motd_ssh
customize