Skip to content

Commit

Permalink
Maintenance: Make service naming consistent in package and source ins…
Browse files Browse the repository at this point in the history
…tallations.
  • Loading branch information
mgruner committed Jun 7, 2022
1 parent 09938aa commit 4608017
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
web: bundle exec script/rails server -b ${ZAMMAD_BIND_IP:=127.0.0.1} -p ${ZAMMAD_RAILS_PORT:=3000}
websocket: bundle exec script/websocket-server.rb -b ${ZAMMAD_BIND_IP:=127.0.0.1} -p ${ZAMMAD_WEBSOCKET_PORT:=6042} start
worker: bundle exec script/background-services.rb start
background-worker: bundle exec script/background-worker.rb start
2 changes: 1 addition & 1 deletion Procfile.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vite: bin/vite dev
web: bundle exec script/rails server -b ${ZAMMAD_BIND_IP:=127.0.0.1} -p ${ZAMMAD_RAILS_PORT:=3000}
websocket: bundle exec script/websocket-server.rb -b ${ZAMMAD_BIND_IP:=127.0.0.1} -p ${ZAMMAD_WEBSOCKET_PORT:=6042} start
worker: bundle exec script/background-services.rb start
background-worker: bundle exec script/background-worker.rb start
2 changes: 1 addition & 1 deletion contrib/packager.io/functions
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function detect_webserver () {

function create_initscripts () {
echo "# (Re)creating init scripts"
zammad scale web=${ZAMMAD_WEBS} websocket=${ZAMMAD_WEBSOCKETS} worker=${ZAMMAD_WORKERS}
zammad scale web="${ZAMMAD_WEBS}" websocket="${ZAMMAD_WEBSOCKETS}" background-worker="${ZAMMAD_WORKERS}"

echo "# Enabling Zammad on boot"
${INIT_CMD} enable zammad
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion script/scheduler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
require 'bundler'
require 'daemons'

DEPRECATION_WARNING = "'script/scheduler.rb' is deprecated and will be removed with Zammad 6. Please use 'script/background-services.rb' instead - note that this will not daemonize but always stay in the foreground.".freeze
DEPRECATION_WARNING = "'script/scheduler.rb' is deprecated and will be removed with Zammad 6. Please use 'script/background-worker.rb' instead - note that this will not daemonize but always stay in the foreground.".freeze
warn "DEPRECATION WARNING: #{DEPRECATION_WARNING}"

def before_fork
Expand Down
6 changes: 5 additions & 1 deletion script/systemd/install-zammad-systemd-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ test -d ${SYSTEMD_SERVICE_DIR} || mkdir -p ${SYSTEMD_SERVICE_DIR}

cp zammad.env ${ZAMMAD_ENV_DIR}

cp zammad.service zammad-rails.service zammad-scheduler.service zammad-websocket.service ${SYSTEMD_SERVICE_DIR}
cp zammad.service zammad-web.service zammad-background-worker.service zammad-websocket.service ${SYSTEMD_SERVICE_DIR}

# Remove renamed services if they exist.
rm -f "${SYSTEMD_SERVICE_DIR}/zammad-scheduler.service"
rm -f "${SYSTEMD_SERVICE_DIR}/zammad-rails.service"

systemctl daemon-reload

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
[Unit]
Description=Zammad scheduler
Description=Zammad Background Worker
After=syslog.target
After=network.target
After=zammad.service
Requires=zammad.service

[Service]
Type=forking
EnvironmentFile=/etc/zammad/zammad.env
User=zammad
Group=zammad
Restart=always

WorkingDirectory=/opt/zammad

ExecStart=/bin/bash -l -c "${BUNDLE_BINARY} exec script/scheduler.rb start"
ExecStart=/bin/bash -l -c "${BUNDLE_BINARY} exec script/background-worker.rb start"

[Install]
WantedBy=zammad.service
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Unit]
Description=Zammad rails server
Description=Zammad Web Server
After=syslog.target
After=network.target
After=zammad.service
Expand Down
2 changes: 1 addition & 1 deletion script/systemd/zammad-websocket.service
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Unit]
Description=Zammad websocket
Description=Zammad Websocket Server
After=syslog.target
After=network.target
After=zammad.service
Expand Down
4 changes: 2 additions & 2 deletions script/systemd/zammad.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Description=Zammad
After=syslog.target
After=network.target
StopWhenUnneeded=true
Wants=zammad-rails.service
Wants=zammad-scheduler.service
Wants=zammad-web.service
Wants=zammad-background-worker.service
Wants=zammad-websocket.service

[Service]
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/background_services/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'rails_helper'

RSpec.describe BackgroundServices::Cli, ensure_threads_exited: true do
context 'when invoking scripts/background-services.rb via CLI' do
context 'when invoking scripts/background-worker.rb via CLI' do

context 'without arguments' do
it 'shows a help screen' do
Expand Down

0 comments on commit 4608017

Please sign in to comment.