A mini e-commerce application built with Rails 4.2 for purposes of teaching Rails by example.
- 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 runningbundle updatewill introduce breaking changes. ThePumaGem usually needs to be updated when going through the install and possiblyrmagickas-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 - postgresto 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 necessarybasis. - 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.
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 updatesudo apt-get upgrade- openssl version ( ensure openssl is version 1.1 )
Removing windows subsystem for linux:
wsl --unregister <distro_name>// generally ubuntuC:\Users\<YourUsername>\AppData\Local\Packages// find distro folder and delete. This can contain a virtual hard drive for the system.Restart Windows
- Install RVM using guide here - rvm.io
rvm install 2.3.5// required to install application dependenciesrmv install 3.x// required to install rails 4.2
- 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
- Use Ruby 3.x
- Install rails 4.2 with RVM - rvm.io
- Switch back to Ruby 2.3.5
- Run
bundle installto install dependencies - Create
config/database.ymlby copyingconfig/database.example.yml - Create
config/secrets.ymlby copyingconfig/secrets.example.yml - Run
bin/rake db:resetto create, load and seed db - Create .env file based on .env.example
- Sign up for a Stripe account
- Put Stripe (test) keys into appropriate .env vars
- Run
bin/rails s -b 0.0.0.0to start the server
- Use Credit Card # 4111 1111 1111 1111 for testing success scenarios.
- More information in their docs: https://stripe.com/docs/testing#cards
- Ruby 2.3.5 and 3.x
- Rails 4.2 Rails Guide
- PostgreSQL 9.x
- Stripe
- 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 )