Coder Social home page Coder Social logo

trysmr / rideshare Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andyatkinson/rideshare

0.0 1.0 0.0 18.16 MB

Rails app for book "High Performance PostgreSQL for Rails"

Home Page: https://pragprog.com/titles/aapsql/high-performance-postgresql-for-rails/

Shell 14.97% JavaScript 0.17% Ruby 61.95% CSS 0.50% HTML 3.56% PLpgSQL 18.85%

rideshare's Introduction

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

rideshare's People

Contributors

andyatkinson avatar dependabot[bot] avatar momer avatar drnic avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.