Ethan Kay Ethan Kay - 1 year ago 144
Swift Question

Heroku Procfile for Perfect 2.0

I am trying to deploy Perfect 2.0 (which uses the swift package manager) on Heroku. A current build pack for Swift 3 and Perfect 2.0 exists and I have tested and pushed the below template with this buildpack to a heroku app successfully without build errors. In particular, I am trying to get Perfect's base template example--which runs fine locally--to deploy to heroku as a proof of concept. The problem, however, is that this build pack requires a top-level Procfile to inform heroku as to how to access the perfect server. In Perfect 1.0 this procfile was simply

web: perfectserverhttp --port $PORT
, but with this new procfile
is not a recognized command. In my heroku logs it errors with
bash: perfectserverhttp: command not found
. What is the appropriate way to handle this? i.e. how should I construct my procfile, and with what command do I access my server instance? I can get things to run locally by creating a procfile with
web: .build/debug/<given_package.swift_name>
, but this does not translate to a deployment on heroku.

Answer Source

I've forked that project and made a Heroku Button deployable version here. In order to get that working, I checked out the sample app, and found that the build dumped the binary in .build/release/PerfectTemplate, so your Procfile should be:

web: .build/release/PerfectTemplate --port $PORT

Note, you also want to set the $PORT. If you've deployed but failed prior to this, you'll also want to make sure you scale up the web dyno: heroku ps:scale web=1.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download