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

Heroku uses Mailgun - a Heroku addon that incurs additional charges - to send email containing a confirmation link when new users sign up. If you are only using Pulsar to test it out locally, then you don't need to add Mailgun. Hence, you can omit from the .env file the Mailgun environment variables that were discussed on the deployment page. If you do that though, you'll have to look in the log file for the confirmation code. Pulsar still logs the message that it would have sent out had email been configured, so you can parse the confirmation code out of there. For example, you would see something like this in the log file for a new user named bob:

... Sent mail to [email protected] (25.7ms) Date: Sun, 17 Dec 2017 00:05:34 -0800 From: [email protected] To: [email protected] Message-ID: [email protected] Subject: New Account on Pulsar Mime-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Welcome [email protected]!

You can confirm your account email through the link below:

Confirm my account

Once your account is active, you'll have viewer status by default.
If you need access to create and edit objects, please email support at [email protected]

...