mardi 4 décembre 2018

Redis and Sidekiq in production on Ubuntu 16.04 using systemd and Deployment with Capistrano

I am deploying sidekiq in ubuntu 16.04 using systemd service with Capistrano.

Sidekiq system service file /lib/systemd/system/sidekiq.service

#
# systemd unit file for CentOS 7, Ubuntu 15.04
#
# Customize this file based on your bundler location, app directory, etc.
# Put this in /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
# Run:
#   - systemctl enable sidekiq
#   - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process.  Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
#
# See Inspeqtor's Systemd wiki page for more detail about Systemd:
# https://github.com/mperham/inspeqtor/wiki/Systemd
#
[Unit]
Description=sidekiq
# start us only once the network and logging subsystems are available,
# consider adding redis-server.service if Redis is local and systemd-managed.
After=syslog.target network.target

# See these pages for lots of options:
# http://0pointer.de/public/systemd-man/systemd.service.html
# http://0pointer.de/public/systemd-man/systemd.exec.html
[Service]
Type=simple
WorkingDirectory=/opt//current
# If you use rbenv:
# ExecStart=/bin/bash -lc 'bundle exec sidekiq -e production'
# If you use the system's ruby:
ExecStart=/usr/local/bin/bundle exec sidekiq -e production -C config/sidekiq.yml -L log/sidekiq.log
User=deploy
Group=deploy
UMask=0002

# if we crash, restart
RestartSec=1
Restart=on-failure

# output goes to /var/log/syslog
StandardOutput=syslog
StandardError=syslog

# This will default to "bundler" if we don't specify it
SyslogIdentifier=sidekiq

[Install]
WantedBy=multi-user.target

But when start the sidekiq service using below command it not showing any error:

sudo systemctl start/stop sidekiq

In the status it throwing an error with an exit code sudo systemctl status sidekiq

● sidekiq.service - sidekiq
   Loaded: loaded (/lib/systemd/system/sidekiq.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Tue 2018-12-04 01:24:39 PST; 754ms ago
  Process: 28133 ExecStart=/usr/local/bin/bundle exec sidekiq -e production -C config/sidekiq.yml -L log/sidekiq.log (code=exited, status=217/US
 Main PID: 28133 (code=exited, status=217/USER)

Dec 04 01:24:39 tt-apps-05 systemd[1]: sidekiq.service: Unit entered failed state.
Dec 04 01:24:39 tt-apps-05 systemd[1]: sidekiq.service: Failed with result 'exit-code'.

I am not able to Identify what is the problem here can any one help me.

Aucun commentaire:

Enregistrer un commentaire