Muhammad Faisal Iqbal

Joined

30 Experience
0 Lessons Completed
0 Questions Solved

Activity

Hi
I added a file at /etc/systemd/system/sidekiq.service

[Unit]
Description=sidekiq
After=syslog.target network.target

[Service]
Type=simple
WorkingDirectory=/home/deploy/ezlarm-server/current

ExecStart=/home/deploy/.rbenv/shims/bundle exec "sidekiq -e production"
User=deploy
Group=deploy
UMask=0002

Environment=MALLOC_ARENA_MAX=2

RestartSec=1
Restart=on-failure

StandardOutput=syslog
StandardError=syslog

SyslogIdentifier=sidekiq

[Install]
WantedBy=multi-user.target

not while running

systemctl {start,stop,restart} sidekiq

it gives following errors

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'stop.service'.
Authenticating as: ,,, (deploy)
Password: 
==== AUTHENTICATION COMPLETE ===
Failed to start stop.service: Unit stop.service not found.
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'restart.service'.
Authenticating as: ,,, (deploy)
Password: 
==== AUTHENTICATION COMPLETE ===
Failed to start restart.service: Unit restart.service not found.
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'sidekiq.service'.
Authenticating as: ,,, (deploy)
Password: 
==== AUTHENTICATION COMPLETE ===

Where did I went wrong?

Posted in Deploy Ubuntu 18.04 Bionic Beaver Discussion

Thanks a lot for this.
just one thing beyond this,
I added sidekiq, now how can I start it and and hanlde auto restart on die etc things?

Hi @Chris
I was not aware of your articel and deployed rails app following
Deploying a Rails App on Ubuntu 14.04 with Capistrano, Nginx, and Puma

My first app is working fine
for second I added nginx.cong as

upstream puma {
  server unix:///home/myappuser/apps/ezlarm-server/shared/tmp/sockets/ezlarm-server-puma.sock;
}

server {
  listen 80 default_server deferred;
  listen [::]:80 ipv6only=on default_server deferred;
  # server_name example.com;

  root /home/myappuser/apps/ezlarm-server/current/public;
  access_log /home/myappuser/apps/ezlarm-server/current/log/nginx.access.log;
  error_log /home/myappuser/apps/ezlarm-server/current/log/nginx.error.log info;

  location ^~ /assets/ {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
  }

  try_files $uri/index.html $uri @puma;
  location @puma {
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://puma;
  }

  error_page 500 502 503 504 /500.html;
  client_max_body_size 10M;
  keepalive_timeout 10;
}

now when I restart nginx, it gives error

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

and systemctl status nginx.service shows this

nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2019-03-23 17:02:33 UTC; 1min 5s ago
     Docs: man:nginx(8)
  Process: 28592 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=0/SUCCESS)
  Process: 28505 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 28594 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
 Main PID: 28509 (code=exited, status=0/SUCCESS)

not sure if this is right place to ask but can you point me towards right direction

Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

© 2023 GoRails, LLC. All rights reserved.