Como faço para inicializar o sidekiq após a inicialização do servidor ou vps? Tentei utilizar o crontab e um script, porém ocorre um conflito com o Ruby. O i-Diario exige um e o nginx exige outro e o crontab tenta inicializar o sidekiq pelo Ruby do nginx, disparando um erro.
Acredito que utilizar o Supervisor ou o Monit pode ser uma opção melhor, pois além de inicializar o sidekiq, se parar por algum motivo ele sobe novamente.
Mestre @dill com muita luta consegui fazer o sidekiq começar a funcionar como um serviço, porém a sincronização não sai de 0%. Segue o arquivo do serviço
#Inicio
[Unit]
Description=sidekiq
After=syslog.target network.target
[Service]
Type=simple
WorkingDirectory=/i-diario-1.0.8
#ExecStart=/bin/bash -lc "bundle exec sidekiq -e production -C config/sidekiq.yml"
ExecStart=/bin/bash -lc "RAILS_ENV=production /usr/share/rvm/gems/ruby-2.2.6/gems/bundler-1.17.3/exe/bundle exec sidekiq -e production -C config/sidekiq.yml -L log/sidekiq.log"
#ExecReload=/usr/bin/kill -TSTP $MAINPID
#User=root # usuario q esta instalado o ruby etc…
#Group=root # grupo q esta instalado o ruby etc…
UMask=0002
#if we crash, restart
RestartSec=1
Restart=on-failure
#Restart=always
#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
root@ubuntu-s-1vcpu-1gb-nyc1-01:/i-diario-1.0.8# RAILS_ENV=production /usr/share/rvm/gems/ruby-2.2.6/gems/bundler-1.17.3/exe/bundle exec sidekiq -e production -C config/sidekiq.yml
2019-11-12T15:26:47.635Z 29103 TID-gmskpdfm4 INFO: Booting Sidekiq 5.0.3 with redis options {:url=>"redis://localhost:6379", :id=>"Sidekiq-server-PID-29103"}
2019-11-12T15:26:53.573Z 29103 TID-gmskpdfm4 INFO: Running in ruby 2.2.6p396 (2016-11-15 revision 56800) [x86_64-linux]
2019-11-12T15:26:53.575Z 29103 TID-gmskpdfm4 INFO: See LICENSE and the LGPL-3.0 for licensing details.
2019-11-12T15:26:53.575Z 29103 TID-gmskpdfm4 INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
2019-11-12T15:26:53.600Z 29103 TID-gmskpdfm4 INFO: Starting processing, hit Ctrl-C to stop
Executando o comando ‘RAILS_ENV=production /usr/share/rvm/gems/ruby-2.2.6/gems/bundler-1.17.3/exe/bundle exec sidekiq -e production -C config/sidekiq.yml -L log/sidekiq.log’ no terminal e na raiz, o terminal devolve a seguinte mensagem:
Could not locate Gemfile or .bundle/ directory
Executando na pasta do i-diario, funciona.
Acho eu que essa linha: WorkingDirectory=/i-diario-1.0.8 , não está surtindo o efeito desejado.
Pessoal, estou com essa mesma situação. Estava sincronizando normalmente até reiniciar o servidor, após isso, ele não sai mais de 0,00%. Porém, ele faz o processo certo, mais parece não achar nada para sincronizar. Então aparentemente parece tudo normal, mais não trás nenhuma informação.