# Start worker only on first instance

**URL:** <https://community.fly.io/t/start-worker-only-on-first-instance/3476>\
**Category:** General\
**Tags:** elixir\
**Created:** [December 21, 2021, 5:27pm UTC](https://community.fly.io/t/start-worker-only-on-first-instance/3476 "2021-12-21T17:27:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mathiasn](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/mathiasn/32/35151_2.png) [@mathiasn](https://community.fly.io/u/mathiasn)\
**Post date:** [December 21, 2021, 5:27pm UTC](https://community.fly.io/t/start-worker-only-on-first-instance/3476/1 "2021-12-21T17:27:51Z")

</div>

Hello,

I have an Elixir app which has some hard working background jobs. I only want to let them run on one node for the moment, the first one would be feasible. Is there a best practise how to do that?  
As all instances share the same set of environment variable, I don’t see a good solution here.

---

<div class="post-metadata">

**Author:** ![kurt](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/kurt/32/43757_2.png) [@kurt](https://community.fly.io/u/kurt)\
**Post date:** [December 21, 2021, 11:35pm UTC](https://community.fly.io/t/start-worker-only-on-first-instance/3476/2 "2021-12-21T23:35:02Z")

</div>

This is an interesting problem. In the Rails world, you’d do this with two `[processes]`: [Preview: multi process apps (get your workers here!)](https://community.fly.io/t/preview-multi-process-apps-get-your-workers-here/2316)

That would probably work for your Elixir app too.

You could use postgres to elect a “leader” VM, but it’d take some work.
