Development environment : running sidekiq and discourse at startup


#1

My development environment is a dedicated Ubuntu server (my project involves two web apps interacting with each other, too heavy and too complicated to set up locally). On this server, I would like to run sidekiq and discourse at startup. I played with rc.local, but couldn’t figure it out. Anyone succeeded with this?


(Matt Palmer) #2

Why can’t you run Discourse in a docker container, as recommended?


#3

Because I develop plugins.


(Rafael dos Santos Silva) #4

Sidekiq creator just tweeted about this:

If Discourse is auto starting in this setup you created, just add a new line there to start sidekiq. If you are on latest Ubuntu that would be a systemd service file.

Not sure why you need an auto starting Sidekiq in a dev instance tough. That’s where I enjoy having a tighter control about stuff like sidekiq.


#5

Thanks a lot @Falco. My Discourse doesn’t auto start, that is my problem. And systemd looks very complicated to set up…

Only because it is recommended here (at the end): Discourse does a lot of stuff async, so it’s better to run sidekiq even on development mode.


(cpradio) #6

There is a screen script that you can run that will start all necessary components

It is setup for the vagrant image but should be easy to amend.

Make a copy of it and change the cd /vagrant to your discourse directory


#7

Amazing, thanks @cpradio!

Notice that I was not able to start sidekiq this way. Or was I? The various sidekiq-related messages are confusing, to say the least, but as sidekiq seems to be optional, I will forget about it for now.


(Mittineague) #8

Well, it is and it isn’t, depending on what you’re testing. Sidekiq handles a lot of “jobs” like updating the Users page, etc.

On my localhost when I want sidekiq to be running I usually just open another terminal and start it in that.


(cpradio) #9

To find out, you simply need to press CTRL + a, ", it will show you a list, move up to the sidekiq one and press enter.

Here is a screenshot of the list

Here is the sidekiq window

There are a lot of good references out there for using screen, GNU screen [quick_reference] and linux screen keyboard shortcuts, for example.


#10

Thanks @cpradio. I had mistakenly added a -d option, that’s why I had no output in the window. I also had this Discourse message saying that Sidekiq was not running (I have no explanation for this). But the message is gone now and everything looks fine. Thanks again.


#11

I am having similar problems running sidekiq in a docker development environment. I have explored other topics with no success. I know sidekiq is running because going to localhost:3000/sidekiq shows me the sidekiq dashboard. I also see that every job stays in the Enqueued section. I have three terminal windows in my development environemt.

  1. Rails server that I started with d/rails s
  2. Mailcatcher that I started with d/mailcatcher
  3. Sidekiq that I started with d/sidekiq

I just cant for the life of me figure out why the admin dashboard says that sidekiq is not running, and why jobs stay in the enqueued section


#12

I always have this warning message and Sidekiq works like a charm. So I came to the conclusion it’s the standard behavior for a dev instance.

This workaround worked for me: change config.eager_load to true in development.rb. See this thread:


#13

Thank you! That fixed it