Skip to content

nicholasrwx/Jungle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jungle

A mini e-commerce application built with Rails 4.2 for purposes of teaching Rails by example.

Setup Notes

  • If there is a dependency that needs to be upgraded and the installation fails, run bundle update dependency_name. It will upgrade the dependency and continue installing the rest where it left off. Keep doing this for every dependency it fails on. Simply running bundle update will introduce breaking changes. The Puma Gem usually needs to be updated when going through the install and possibly rmagick as-well.
  • Publishable Key and Secret Key are the only vars in .env that need a value. They do not need to be in quotes.
  • You need to enable strip testing capability in stripe account for test cards to work
  • You need to sudo su - postgres to login to the database and create a role/user. Once this is done the created db user should be able to login from a regular linux user session. It's a good idea to test the connection as a regular user afterwards.
  • Ruby 2.3.5, rails, and some dependencies make use of openssl 1.1, therefore Ubuntu 18.04 is necessary unless you want to mess around with dependency issues.
  • Ruby 2.3.5 works well if you use the right linux version, openssl 1.1, and update packages on an only whats necessary basis.
  • If you already have git setup on your system then wsl should be able to use it no problem.
  • Ruby on Rails doesn't run all too well on windows. There are dependency issues, so it is best to install wsl then install ruby and rails in this linux environment.

Running RoR on Windows 11

Install windows subsystem for linux:

  • wsl --install -d Ubuntu-18.04 // matches the project as we need openssl 1.1 for ruby 2.3.5
  • Restart system
  • open powershell and run wsl
  • sudo apt-get update
  • sudo apt-get upgrade
  • openssl version ( ensure openssl is version 1.1 )

Removing windows subsystem for linux:

  • wsl --unregister <distro_name> // generally ubuntu
  • C:\Users\<YourUsername>\AppData\Local\Packages // find distro folder and delete. This can contain a virtual hard drive for the system.
  • Restart Windows

Ruby on Rails Setup:

  • Install RVM using guide here - rvm.io
  • rvm install 2.3.5 // required to install application dependencies
  • rmv install 3.x // required to install rails 4.2

Postgres Setup:

  • download postgresql deb or tar ( if source list is broken and can't do it through apt )
  • install using deb file or extract tar file with tar -xvzf postgresql-9.6.20.tar.gz
  • follow tar installation instructions
  • switch to postgres super user sudo su - postgres
  • login to postgres psql -U postgres
  • setup database role with login capabilities CREATE USER development;
  • create database jungle_development
  • create database jungle_test
  • logout with \q
  • sign out of super user
  • check postgres is running sudo systemctl status postgresql
  • test connection psql -U development -d jungle_development

Rails Setup:

  • Use Ruby 3.x
  • Install rails 4.2 with RVM - rvm.io
  • Switch back to Ruby 2.3.5

Application Setup

  1. Run bundle install to install dependencies
  2. Create config/database.yml by copying config/database.example.yml
  3. Create config/secrets.yml by copying config/secrets.example.yml
  4. Run bin/rake db:reset to create, load and seed db
  5. Create .env file based on .env.example
  6. Sign up for a Stripe account
  7. Put Stripe (test) keys into appropriate .env vars
  8. Run bin/rails s -b 0.0.0.0 to start the server

Stripe Testing

Dependencies

  • Ruby 2.3.5 and 3.x
  • Rails 4.2 Rails Guide
  • PostgreSQL 9.x
  • Stripe

Additional Dependencies:

  • wsl - Ubuntu 18.04 ( for openssl 1.1 required by ruby, rails, and some deps )
  • node 14.21.3 ( used by rails when running rake command )
  • make
  • pacman
  • brew
  • gcc
  • libssl-dev
  • gpg
  • build-essential
  • gnupg2 ( used for rvm gpg keys )
  • libmagickwand-dev libmagickcore-dev ( required for gem - rmagick 5.5.0 )

About

A mini e-commerce application built with Rails 4.2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published