Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 598 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run Sidekiq as daemon on Ubuntu

#1
How can I run sidekiq as daemon on Ubuntu?

If I run `bundle exec sidekiq -D` I get `invalid option: -D`, is there any way to run it without some other controller, like god, upstart...?
Reply

#2
Daemonization, running a program as Unix, for Sidekiq version 6 or later is not supported. Instead, we have to run the process as a service.

Write a script according to your bundler location, or you can modify the below code snippet and copy the snippet into `/usr/lib/systemd/system` (CentOS) or `/lib/systemd/system` (Ubuntu)

[Unit]
Description=sidekiq

After=syslog.target network.target

[Service]

Type=notify
WatchdogSec=10
WorkingDirectory=/home/deploy/apps/project_name

# If you use rbenv:
# ExecStart=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec sidekiq -e production'
# If you use the system's ruby:
# ExecStart=/usr/local/bin/bundle exec sidekiq -e production
# If you use rvm in production, don't.

#ExecStart=/home/deploy/.rvm/wrappers/ruby-2.6.5/bundle exec sidekiq -e production

# Use `systemctl kill -s TSTP sidekiq` to quiet the Sidekiq process
# !!! Change this to your deploy user account !!!

User=deploy

Environment=MALLOC_ARENA_MAX=2

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

# output goes to /var/log/syslog (Ubuntu) or /var/log/messages (CentOS)
StandardOutput=syslog
StandardError=syslog

# This will default to "bundler" if we don't specify it
SyslogIdentifier=sidekiq
[Install]
WantedBy=multi-user.target

Make sure you have given the correct path of your bundler for `ExecStart` in order to start the process. Save it as `sidekiq.service` and run `systemctl enable sidekiq`. Then we can manage the process using the commands `systemctl start sidekiq`, `systemctl stop sidekiq`, and `systemctl restart sidekiq`.

We can see the last 100 lines of log by using `journalctl -u sidekiq -rn 100`.
Reply

#3
As of sidekiq 6.0 Daemonization wouldnt work and if you pass -d, you'll get a message:

> Daemonization mode was removed in Sidekiq 6.0, please use a proper process supervisor to start and manage your services


check the issue here [#4045][1]


[1]:

[To see links please register here]


Reply

#4
Running as daemon won't restart the `sidekiq` if it crashes unexpectedly. One alternate way could be to run sidekiq as a service (An upstart job). If the system is rebooted than also the upstart job will run sidekiq.
[**Here**][1] is the complete script and method to run sidekiq as a service.

After running sidekiq as a service you can simply `start/stop/restart` sidekiq by command `sudo service sidekiq start/stop/restart`.


[1]:

[To see links please register here]

Reply

#5
there's an option to Daemonize sidekiq, just pass `-d` option

[commit][1]


[1]:

[To see links please register here]

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through