Skip to content

Latest commit

History

History
89 lines (64 loc) 路 2.68 KB

native-installation-instructions.md

File metadata and controls

89 lines (64 loc) 路 2.68 KB

Installing Ruby/Postgres on your local environment

These are the original instructions for natively installing the app to your machine, using local installations of Ruby and Postgres. For most people, we recommend using Docker instead.

Contents

  1. Set up a Ruby Environment
    • Option 1: Using rvm
    • Option 2: Using rbenv and ruby-build
  2. Install and run PostgreSQL
    • Using Homebrew on a Mac
  3. Set up the database
    • Generate sample data
  4. Run the app
  5. Run the tests
  6. (Optional) Note that to be able to use the page as an admin, you must first give yourself admin privileges. Make sure you have started your app and signed up as an user on your locally running app. Then run this on command line: rails runner "Member.find_by(email: '<your email>').add_role(:admin)".

Set up a Ruby Environment

You will need to install Ruby 3.2.2 using RVM or rbenv.

Option 1: Using rvm

CPPFLAGS=-DUSE_FFI_CLOSURE_ALLOC rvm install 3.2.2

We need to set the CPPFLAGS env variable to be able to install Ruby 3.2.2 on M1 Mac machines. See more: ffi/ffi#869 (comment)

Option 2: Using rbenv and ruby-build

rbenv install 3.2.2
rbenv global 3.2.2

Install and run PostgreSQL

The PostgreSQL Wiki has detailed installation guides for various platforms, but probably the simplest and most common method for Mac users is with Homebrew:

Using Homebrew on a Mac

Note: You might need to install another build of Xcode Tools (typing brew update in the terminal will prompt you to update the Xcode build tools).

Install Postgres:

brew update
brew install postgresql
brew services start postgresql

Install other dependencies:

brew install imagemagick

Install the Gems:

gem install bundler
bundle install --without production

Set up the Database

Adjust config/database.yml as needed.

bundle exec rake db:create
bundle exec rake db:migrate db:test:prepare

Note: If you are running OSX Yosemite, you may experience a problem connecting to Postgres. This stackoverflow answer might help.

Generate sample data

bundle exec rake db:seed

Run the app

bundle exec rails server

Run the tests

bundle exec rake