Skip to content
The chapter website!
Branch: main
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

East Bay DSA website

This project aims to replace the existing NationBuilder-backed site with a new website built in Rails, that gives us an easy platform for technical volunteers to join, and a solid foundation for building advanced features going forward.

Getting Started


  • Ruby >= 2.4.0
  • Postgres
  • bundler (gem install bundler)
  • foreman (gem install foreman)

First time setup

Clone the repository source to local machine:

git clone ebdsa-website
cd ebdsa-website

In the cloned directory, install your gem dependencies with bundler:

bundle install

Create your database and run migrations:

bin/rake db:setup
bin/rake db:seed

And start your local server with foreman:

foreman start

Your site will be available at http://localhost:5000

NationBuilder Data

Events are loaded from NationBuilder via its API. To connect to the API, you must supply the following three environment variables:


In development, you can set these in a .env file at your application root.

S3 Upload

We preconfigure some fields to upload file attachments to S3. For this to work you must supply the following environment variables:


In development, you can set these in a .env file at your application root.

The AWS key/secret you use must belong to a user with permission to create S3 objects.

The S3 bucket you use should have the following configuration. First, a bucket policy that allows objects to be publicly readable.

    "Version": "2008-10-17",
    "Statement": [
            "Sid": "AllowPublicRead",
            "Effect": "Allow",
            "Principal": {
                "AWS": "*"
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::$AWS_BUCKET_NAME/*"

Substitute $AWS_BUCKET_NAME for your actual bucket name.

Uploads are done using pre-signed URLs so no general write permissions should be required.

Next, set a bucket CORS policy that will allow requests coming from the site:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="">

Substitute $SITE_FQDN with your actual site FQDN, including protocol (http://, https://) and port number, if one is used.

In development you will probably want to use http://localhost:5000 to allow requests from your local dev server.

You can add additional <AllowedOrigin> lines if needed.



Some helpful info can be found here.

You'll need to be added as a collaborator on any Heroku apps you want to deploy to.

Install the Heroku Toolbelt. You can use Homebrew to do this:

brew install heroku/brew/heroku

Hook your local repo up to the Heroku app by adding a Git remote:

heroku git:remote -a eastbaydsa-staging

Running Tests

Set up the test database (only once)

RAILS_ENV=test bundle exec rake db:create

Run the tests

bundle exec rake

Staging Environment

Visit the stage build at to test your changes.


Use Git to push the code to Heroku:

git push heroku main:master

You can name any local branch you want, but if should be pushed to the master branch on Heroku.

TODO(bcipriano) This is fine for the staging app, but once a prod app is running we should ensure only main can be pushed there.

Next, run db migrations:

heroku run rake db:migrate

You can use the Heroku CLI to open the app in your browser:

heroku open


Updating your DB

After pulling main, if you notice changes to db/schema.rb, run

bundle exec rake db:migrate

If this command fails, try running bundle, and then retry the above command.

Postgres issues

If you encounter this error while working with the database:

psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?

This can be fixed by adding the following environment variable to your shell profile (~/.bash_profile or ~/.zshrc):

export PGHOST=localhost

This works because if PGHOST is not defined, Postgres will attempt to connect to a Unix domain socket instead.

You can’t perform that action at this time.