changed systemd scripts to use env file
This commit is contained in:
parent
45087f76f6
commit
f4efae18c9
6 changed files with 37 additions and 32 deletions
|
@ -3,12 +3,21 @@
|
|||
# enable zammad systemd services
|
||||
#
|
||||
|
||||
ZAMMAD_ENV_DIR="/etc/zammad"
|
||||
SYSTEMD_SERVICE_DIR="/etc/systemd/system"
|
||||
|
||||
if [ "$(whoami)" != 'root' ]; then
|
||||
echo "you need to be root to run this script!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cp zammad.service zammad-rails.service zammad-scheduler.service zammad-websocket.service /etc/systemd/system
|
||||
test -d ${ZAMMAD_ENV_DIR} || mkdir -p ${ZAMMAD_ENV_DIR}
|
||||
|
||||
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}
|
||||
|
||||
systemctl daemon-reload
|
||||
|
||||
|
|
|
@ -6,19 +6,14 @@ After=zammad.service
|
|||
Requires=zammad.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=zammad
|
||||
Group=zammad
|
||||
EnvironmentFile=/etc/zammad/zammad.env
|
||||
User=${ZAMMAD_USER:-zammad}
|
||||
Group=${ZAMMAD_GROUP:-zammad}
|
||||
Restart=always
|
||||
|
||||
WorkingDirectory=/opt/zammad
|
||||
WorkingDirectory=${ZAMMAD_WORKING_DIRECTORY:-/opt/zammad}
|
||||
|
||||
Environment=RAILS_ENV=production
|
||||
Environment=BUNDLE_BINARY=bundle
|
||||
Environment=ZAMMAD_BIND_IP=127.0.0.1
|
||||
Environment=ZAMMAD_RAILS_PORT=3000
|
||||
|
||||
ExecStart=/bin/bash -l -c "${BUNDLE_BINARY} exec script/rails server -b ${ZAMMAD_BIND_IP} -p ${ZAMMAD_RAILS_PORT}"
|
||||
ExecStart=/bin/bash -l -c "${BUNDLE_BINARY:-bundle} exec script/rails server -b ${ZAMMAD_BIND_IP:-127.0.0.1} -p ${ZAMMAD_RAILS_PORT:-3000}"
|
||||
|
||||
[Install]
|
||||
WantedBy=zammad.service
|
||||
|
|
|
@ -6,17 +6,15 @@ After=zammad.service
|
|||
Requires=zammad.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=zammad
|
||||
Group=zammad
|
||||
Type=forking
|
||||
EnvironmentFile=/etc/zammad/zammad.env
|
||||
User=${ZAMMAD_USER:-zammad}
|
||||
Group=${ZAMMAD_GROUP:-zammad}
|
||||
Restart=always
|
||||
|
||||
WorkingDirectory=/opt/zammad
|
||||
WorkingDirectory=${ZAMMAD_WORKING_DIRECTORY:-/opt/zammad}
|
||||
|
||||
Environment=RAILS_ENV=production
|
||||
Environment=BUNDLE_BINARY=bundle
|
||||
|
||||
ExecStart=/bin/bash -l -c "${BUNDLE_BINARY} exec script/scheduler.rb start -t"
|
||||
ExecStart=/bin/bash -l -c "${BUNDLE_BINARY:-bundle} exec script/scheduler.rb start"
|
||||
|
||||
[Install]
|
||||
WantedBy=zammad.service
|
||||
|
|
|
@ -6,19 +6,14 @@ After=zammad.service
|
|||
Requires=zammad.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=zammad
|
||||
Group=zammad
|
||||
EnvironmentFile=/etc/zammad/zammad.env
|
||||
User=${ZAMMAD_USER:-zammad}
|
||||
Group=${ZAMMAD_GROUP:-zammad}
|
||||
Restart=always
|
||||
|
||||
WorkingDirectory=/opt/zammad
|
||||
WorkingDirectory=${ZAMMAD_WORKING_DIRECTORY:-/opt/zammad}
|
||||
|
||||
Environment=RAILS_ENV=production
|
||||
Environment=BUNDLE_BINARY=bundle
|
||||
Environment=ZAMMAD_BIND_IP=127.0.0.1
|
||||
Environment=ZAMMAD_WEBSOCKET_PORT=6042
|
||||
|
||||
ExecStart=/bin/bash -l -c "${BUNDLE_BINARY} exec script/websocket-server.rb -b ${ZAMMAD_BIND_IP} -p ${ZAMMAD_WEBSOCKET_PORT} start"
|
||||
ExecStart=/bin/bash -l -c "${BUNDLE_BINARY:-bundle} exec script/websocket-server.rb -b ${ZAMMAD_BIND_IP:-127.0.0.1} -p ${ZAMMAD_WEBSOCKET_PORT:-6042} start"
|
||||
|
||||
[Install]
|
||||
WantedBy=zammad.service
|
||||
|
|
8
script/systemd/zammad.env
Normal file
8
script/systemd/zammad.env
Normal file
|
@ -0,0 +1,8 @@
|
|||
BUNDLE_BINARY=bundle
|
||||
RAILS_ENV=production
|
||||
ZAMMAD_BIND_IP=127.0.0.1
|
||||
ZAMMAD_GROUP=zammad
|
||||
ZAMMAD_RAILS_PORT=3000
|
||||
ZAMMAD_USER=zammad
|
||||
ZAMMAD_WEBSOCKET_PORT=6042
|
||||
ZAMMAD_WORKING_DIRECTORY=/opt/zammad
|
|
@ -8,9 +8,9 @@ Wants=zammad-scheduler.service
|
|||
Wants=zammad-websocket.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=zammad
|
||||
Group=zammad
|
||||
EnvironmentFile=/etc/zammad/zammad.env
|
||||
User=${ZAMMAD_USER:-zammad}
|
||||
Group=${ZAMMAD_GROUP:-zammad}
|
||||
Restart=always
|
||||
ExecStart=/bin/sleep infinity
|
||||
|
||||
|
|
Loading…
Reference in a new issue