# Development environment : running sidekiq and discourse at startup

**URL:** https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200
**Category:** Development
**Created:** [March 1, 2017, 10:15pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200 "2017-03-01T22:15:47Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![jack2](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jack2](https://meta.discourse.org/u/jack2)
#### Post date: [March 1, 2017, 10:15pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/1 "2017-03-01T22:15:47Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [March 1, 2017, 10:33pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/2 "2017-03-01T22:33:40Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jack2](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jack2](https://meta.discourse.org/u/jack2)
#### Post date: [March 1, 2017, 10:46pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/3 "2017-03-01T22:46:30Z")

</div>

Because I develop plugins.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [March 1, 2017, 10:49pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/4 "2017-03-01T22:49:57Z")

</div>

Sidekiq creator just tweeted about this:

[https://twitter.com/mperham/status/837024296044130304](https://twitter.com/mperham/status/837024296044130304)

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.

---

<div class="post-metadata">

### Author: ![jack2](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jack2](https://meta.discourse.org/u/jack2)
#### Post date: [March 1, 2017, 11:37pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/5 "2017-03-01T23:37:30Z")

</div>

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

> [@Falco](#):
>
> Not sure why you need an auto starting Sidekiq in a dev instance tough.

Only because it is recommended [here](https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md) (at the end): _Discourse does a lot of stuff async, so it’s better to run sidekiq even on development mode_.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [March 1, 2017, 11:46pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/6 "2017-03-01T23:46:30Z")

</div>

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

[https://github.com/discourse/discourse/blob/master/docs/vagrant.screen](https://github.com/discourse/discourse/blob/master/docs/vagrant.screen)

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

---

<div class="post-metadata">

### Author: ![jack2](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jack2](https://meta.discourse.org/u/jack2)
#### Post date: [March 2, 2017, 3:08pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/7 "2017-03-02T15:08:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [March 2, 2017, 3:32pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/8 "2017-03-02T15:32:15Z")

</div>

> [@jack2](#):
>
> sidekiq seems to be optional,

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.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [March 2, 2017, 3:58pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/9 "2017-03-02T15:58:06Z")

</div>

> [@jack2](#):
>
> Notice that I was not able to start sidekiq this way. Or was I?

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

 ![](https://global.discourse-cdn.com/meta/original/3X/4/a/4a31c02f306017c8ac36d96980b424cbbead1644.png)

Here is the sidekiq window

 ![](https://global.discourse-cdn.com/meta/original/3X/9/c/9c880d93b9c8457f8b679ad2f19f1642a280f1c9.png)

There are a lot of good references out there for using `screen`, [quick\_reference [GNU screen]](http://aperiodic.net/screen/quick_reference) and [linux screen keyboard shortcuts](http://www.pixelbeat.org/lkdb/screen.html), for example.

---

<div class="post-metadata">

### Author: ![jack2](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jack2](https://meta.discourse.org/u/jack2)
#### Post date: [March 2, 2017, 5:19pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/10 "2017-03-02T17:19:31Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![drew0101](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drew0101](https://meta.discourse.org/u/drew0101)
#### Post date: [October 24, 2017, 10:55pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/11 "2017-10-24T22:55:02Z")

</div>

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

---

<div class="post-metadata">

### Author: ![jack2](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jack2](https://meta.discourse.org/u/jack2)
#### Post date: [October 26, 2017, 8:08am UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/12 "2017-10-26T08:08:20Z")

</div>

> [@drew0101](#):
>
> I just cant for the life of me figure out why the admin dashboard says that sidekiq is not running,

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.

> [@drew0101](#):
>
> why jobs stay in the enqueued section

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

> [@Webhooks/Sidekiq issue on dev instance](https://meta.discourse.org/t/webhooks-sidekiq-issue-on-dev-instance/71129):
>
> I run 2 Discourse instances: a standard one (Docker) a dev one, behind a nginx proxy I’ve set up the same webhook on both instances. It works well from the standard instance, but not from the dev instance: the Ping button never gets a response and stays gray, although the corresponding POST event seems to appear in the nginx log (EDIT: this log entry is about the click event localhost-\>Discourse, not the outgoing webhook ping message). I see no error in the Discourse server console or n…

---

<div class="post-metadata">

### Author: ![drew0101](https://avatars.discourse-cdn.com/v4/letter/d/54ee81/32.png) [@drew0101](https://meta.discourse.org/u/drew0101)
#### Post date: [October 26, 2017, 5:46pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/13 "2017-10-26T17:46:46Z")

</div>

Thank you! That fixed it

---

<div class="post-metadata">

### Author: ![jack2](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jack2](https://meta.discourse.org/u/jack2)
#### Post date: [October 26, 2018, 12:45pm UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/14 "2018-10-26T12:45:45Z")

</div>

It seems Sidekiq is now launched automatically when the dev instance starts. Am I right? Still any need to launch it manually?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [October 30, 2018, 5:39am UTC](https://meta.discourse.org/t/development-environment-running-sidekiq-and-discourse-at-startup/58200/15 "2018-10-30T05:39:19Z")

</div>

If you run `bin/unicorn` it automatically runs sidekiq if you don’t want sidekiq run `bin/unicorn -x`
