Skip to content

Inventium/rideshare

 
 

Repository files navigation

CircleCI

High Performance PostgreSQL for Rails

Rideshare is the Rails application for: High Performance PostgreSQL for Rails

Installation

Prepare your development machine.

Homebrew Packages

First, install Homebrew.

Graphviz

brew install graphviz

Ruby Version Manager

Before installing Ruby, install a Ruby version manager. The recommended one is Rbenv. Install:

brew install rbenv

PostgreSQL

If you've installed version 16 of PostgreSQL via Homebrew, that's fine. If not:

  • Install Postgres.app, which is the recommended method
  • From the Menu Bar app, click "+", then add a PostgreSQL 16 server

PostgreSQL configuration follows: My GOTO Postgres Configuration for Web Services

Ruby Version

Run cat .ruby-version to find the version of Ruby that Rideshare uses.

To install 3.2.2, run:

rbenv install 3.2.2

Run rbenv versions to confirm the correct version is used (has an asterisk):

  system
* 3.2.2 (set by /Users/andy/Projects/rideshare/.ruby-version)

Running into trouble? Review Learn how to load rbenv in your shell. using rbenv init.

Bundler and Gems

Bundler is included when you install Ruby using Rbenv. You're ready to install gems:

bundle install

Rideshare development database

Normally in Rails, you'd run bin/rails db:create. Rideshare uses a custom script.

To create the database and objects, you'll use db/setup.sh

Before running it, ensure the following environment variables are set:

  • RIDESHARE_DB_PASSWORD
  • DB_URL

Review the script comment header section for more information on the values.

Once you've both environment variables, run the script as follows. This version captures output to output.log.

sh db/setup.sh 2>&1 | tee -a output.log

Since you set RIDESHARE_DB_PASSWORD earlier, create or update the file ~/.pgpass and add the password value. Refer to postgresql/.pgpass.sample for a sample entry.

When you've updated it, ~/.pgpass should look as follows. Replace the last segment 2C6uw3LprgUMwSLQ below with the password value you generated.

localhost:5432:rideshare_development:owner:2C6uw3LprgUMwSLQ

Run chmod 0600 ~/.pgpass.

Finally, run export DATABASE_URL=<value from .env>, setting the value from the .env file. Once that's set:

Verify you can connect by running: psql $DATABASE_URL. Once connected, run this from psql:

SELECT current_user;

Confirm you're connected as owner. Then run the describe namespace meta-command:

\dn

Verify the rideshare schema is visible. Run the describe table meta command: \dt to view the Rideshare tables.

Run Migrations

Migrations in Rideshare are preceded by SET role = owner, so they run as owner. This user owns the tables.

See: lib/tasks/migration_hooks.rake

Run migrations the standard way:

bin/rails db:migrate

If the tables were created successfully in the rideshare schema, you're good to go!

Development Guides and Documentation

Troubleshooting

The Rideshare repository has many README.md files within subdirectories. Run find . -name 'README.md' to list them.

UI

Although Rideshare is an API-only app, there are some UI elements.

Rideshare runs PgHero which has a UI.

Connect to it:

bin/rails server

Once that's running, visit http://localhost:3000/pghero in your browser.

Screenshot of PgHero for Rideshare

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 61.8%
  • PLpgSQL 18.8%
  • Shell 15.0%
  • HTML 3.6%
  • CSS 0.5%
  • JavaScript 0.2%
  • Makefile 0.1%