This application is an ecommerce application that sells 6 different types of product categories across U.K. and has warehouses in over 200 locations. It shows relationship between different tables, separate login for customers and admin dashboard. It has live maps, admin dashboard charts, search filter and featured product graph for customers, capturing session details of customers with other security measures and test cases.
The live application has been deployed on the heroku platform in postgres database and can be accessed through the following link: https://sukha-happy-shopping.herokuapp.com/
POINT TO NOTE - Clone the Master branch(sub-branch) of this repository and make changes in database.yml file to run in your system.
- Ruby version - 2.6.5
- Rails version - 6.0.3.4
- Heroku - heroku/7.47.0 linux-x64 node-v12.16.2
- Gems installed are:
- pg version 1.2.3 (by default)
- bootstrap version 3.4.1
- gem 'faker'
- gem 'devise'
- gem 'activeadmin'
- gem 'bootstrap'
- gem 'chartkick'
- gem 'brakeman'
Run the following commands:
- cd workspace
- git clone -b master https://github.com/BarkaviSJ/sukhashopping.git (because the master sub-branch of main has the complete code)
- cd sukhashopping
- bundle install
- yarn install --check-files
- change the databse.yml file with yoru postgres username and password and remove the production database url
- rails db:migrate
- rake db:seed
- replace the line in config/enviroment/development.rb between the bold text with the name of you local box name config.hosts << "mama-sigma--3000.codio-box.uk"
- rails server -b 0.0.0.0
- access application at https://yourboxname-3000.codio-box.uk
- rails new eshopping(appname) –database=postgresql
- cd appname
- rake db:setup in local device automatically takes the environment variable and saves it in database.yml in config. In case of developing via codio environment, it requires the exact username and password available in the project.
- a. Created scaffold generate command only for the main tables such as products, customers and orders. Remaining tables such as shopping cart, shipping details, payments, line items and stores are manually created as and when needed to have a cleaner code without redundant details. b. rails generate migration AddTableToTheSchema
- rails db:migrate after creating the scaffold and generation
- In addition to some fake data using faker gem, open data from Kaggle and U.K. government websites were taken to populate the database and used for linking different tables.
- rails server – localhost:/3000
- rails server -b 0.0.0.0
- created separate git repo for deployment
- created Heroku account
- created an app in Heroku
- git remote -v
- git remote add github “url of git repo”
- git add .
- git commit -m “comment” – updates files inserted and changes
- heroku login –interactive
- heroku apps
- heroku git:remote -a ----this commands sets git remote heroku to https://git.heroku.com/eshoprails.git
- git remote -v ------this command shows heroku and hithub’s fetch and push url
- git push heroku main to commit from main branch or
- git push heroku base:main to commit from development branch
- heroku run rake db:setup – PG::ConnectionBad: FATAL - wrong
- Ensure that the databse.yml file has the username and password removed both from default and production and take the URL it states in yml for production
- heroku addons:create heroku-postgresql:hobby-dev – finally created postgressql database with the name “HEROKU_POSTGRESQL_COPPER_URL” Paste this URL in database.yml file - until this step was completed, the error mentioned in step 14 will occur.
- Repeated git steps for commits
- heroku run rake db:schema:load – to be used only for first time
- heroku run rake db:migrate
- heroku run rake db:seed - this need to be updated everytime the database changes are made
- All the developed functionalities work in codio and heroku deployed
- The images are working well in localhost but broken in codio and heroku
- the pages need to be refreshed to get the information shopping cart.
- The map location page in store need to be refreshed to get the live location
-
admin user credentials - https://sukha-happy-shopping.herokuapp.com/admin email is admin@example.com and password is
-
Git text log from initial could not be retrieved from my local device beacuse it got terminated. The screenshot of git log commits committed using different branches in another repository are in the attached screenshot.
Below is the latest gitlog history for my final deployed application.
barkavis@Barkavis-MBP Eshoppingrails-base % git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" f7b3fb0 barkavi-jf Mon Dec 7 22:26:35 2020 assets final 551f57b barkavi-jf Mon Dec 7 22:22:48 2020 assets 587656e barkavi-jf Mon Dec 7 21:55:44 2020 added heroku postgresdb in yml 1069667 barkavi-jf Mon Dec 7 21:44:23 2020 final deployment