Skip to content

Run app locally with Heroku

Nathan Watson edited this page Dec 17, 2017 · 27 revisions

You can use deploy Pulsar locally for testing purposes, but first make sure you already have PostgreSQL installed. You also need to create the Postgres database for the development environment. Open up config/database.yml. Find the block that says "development" and then take note of the value of the "database" property. You'll need to create a Postgres database locally that has the same name. You can do this using createdb, which comes prepackaged with PostgreSQL.

Heroku CLI has a command heroku local that allows you to start an app locally. This command should be run in the root folder of the app, as it expects a .env file in the app's root directory that stores key=value environment variable settings. You'll need to add to this file the key=value settings for the environment variables that were discussed on the deployment page.

It's best if you go ahead and set up an S3 bucket as mentioned on the deployment page, so that you can set the relevant AWS environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and S3_BUCKET) in the .env file. You can omit this step if you don't plan on uploading any files when you test locally. It's worth noting here that there are some form fields that upload files directly to the database (i.e. protocols that can be reused across different objects), and you'll be just fine in this case. But other form fields upload image files and other one-off files to a specified AWS bucket. In this latter case, you'll run into trouble when skipping these environment variables, and see an error that reads "undefined method `presigned_post' for nil:NilClass".

Furthermore, you'll need to add environment variables that the Mailgun addon exported (don't worry if you haven't set up mailgun yet, you'll still be able to use your test deployment as described on the Mailgun wiki page).