How to create Heroku Worker process with Vapor 3 / Swift 4.1.2

181 Views Asked by At

I'm trying to create a webAPI and a Worker process (on Heroku) with Vapor 3, XCode 9.4.1, Swift 4.1 but can't get the solution working that's described in SO "Multiple targets in Vapor Xcode project". The webAPI is working fine but how do I create the Worker ?

Thanks for any advice,

Frank

1

There are 1 best solutions below

2
Logan On

You should be able to just add a worker and a web process.

web: Run serve --env production --hostname 0.0.0.0 --port $PORT 
worker: NameOfYourWorkerHere

I'm pretty sure heroku let's you start multiple processes in this way, if not, you might have to spin up two instances, one for the worker, one for the web.