Coder Social home page Coder Social logo

thanhtungka91 / littlecornerjapan Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 2.57 MB

a shoping online using spree framework

Ruby 95.27% JavaScript 0.43% CSS 0.26% HTML 4.04%
rvm ruby-on-rails spree-ecommerce postgresql nginx passenger-ruby javascript

littlecornerjapan's Introduction

README

This app is deploy on amz ec 2, ubuntu 16.04

https://littlecornerjapan.com

Demo

Try Spree framework with direct deployment on Heroku:

Deploy

  • Ruby version: 2.3.4

    • using rvm for manage Ruby version 1 sudo apt-get update
    sudo apt-get install -y curl gnupg build-essentialsudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
    sudo apt-get install -y curl gnupg build-essential
    sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
    curl -sSL https://get.rvm.io | sudo bash -s stable
    sudo usermod -a -G rvm `whoami`
    if sudo grep -q secure_path /etc/sudoers; then sudo sh -c "echo export rvmsudo_secure_path=1 >> /etc/profile.d/rvm_secure_path.sh" && echo Environment variable installed; fi
    rvm install 2.3.4
    
    • Relog Terminate for using rvm

    • Install ruby 2.3.4

    rvm install 2.3.4
    rvm --default use 2.3.4
    
    • Install bundle
    gem install bundler --no-rdoc --no-ri
    
  • System dependencies Ubuntu 16.04

    • Imagemagick
    sudo apt-get install imagemagick libmagickcore-dev libmagickwand-dev libmagic-dev
    sudo apt-get install imagemagick
    sudo apt-get update
    
    • Postgres Library
    sudo apt-get update
    sudo apt-get install libpq-dev
    
    • Nodejs
    sudo apt-get install -y nodejs && sudo ln -sf /usr/bin/nodejs /usr/local/bin/node
    
  • Database creation

    • Instal postgres
    sudo apt-get update
    sudo apt-get install postgresql postgresql-contrib
    sudo -u postgres psql
    
    • Create DB
    CREATE DATABASE dbname;
    CREATE USER tungvt WITH SUPERUSER;
    ALTER USER tungvt WITH PASSWORD 'password';
    ALTER DATABASE dbname OWNER TO tungvt;
    
  • Database initialization

    • Create Admin user
    bundle exec rake spree_auth:admin:create RAILS_ENV=production
    
  • How to run on production server

    • Build source then migrate db, seed
    bundle install --deployment --without development test
    bundle exec rake assets:precompile RAILS_ENV=production
    bundle exec rake db:seed RAILS_ENV=production
    
    • gen sitemap
    bundle exec rake sitemap:refresh RAILS_ENV=production
    
  • Deployment instructions

    • Install nginx, passenger
    sudo apt-get install -y dirmngr gnupg
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2F7
    sudo apt-get install -y apt-transport-https ca-certificates
    sudo sh -c 'echo deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main > /etc/apt/sources.list.d/passenger.list'
    sudo apt-get update
    sudo apt-get install -y nginx-extras passenger
    

    uncomment passenger ro ngnix

    sudo vi /etc/nginx/nginx.conf
    
    

    nginx.conf look like:

        ...
    
    http {
        include /etc/nginx/passenger.conf;
        ...
    }
    
    sudo service nginx restart
    sudo /usr/bin/passenger-config validate-install
    sudo /usr/sbin/passenger-memory-stats
    sudo apt-get update
    sudo apt-get upgrade
    

    Create new domain

    nano /etc/nginx/sites-enabled/myapp.conf 
    sudo nano /etc/nginx/sites-enabled/myapp.conf 
    

    myapp.conf looke like

    server {
        listen 80;
        server_name yourserver.com;
    
        # Tell Nginx and Passenger where your app's 'public' directory is
        root /var/www/myapp/code/public;
    
        # Turn on Passenger
        passenger_enabled on;
        passenger_ruby /path-to-ruby;
    }
    

    whereas ruby_path which you can get from the command

    passenger-config about ruby-command
    
  • Config STMP with Sendgird

    1. Go to sendgrid and create an account
    SMTP DOMAIN 
    smtp.sendgrid.net
    SMTP MAIL HOST 
    smtp.sendgrid.net
    SMTP PORT 
    587
    SECURE CONNECTION TYPE
    None
    SMTP AUTHENTICATION TYPE
    login
    SMTP USERNAME 
    thanhtungka91
    SMTP PASSWORD
  • Config SSL with cerbot
    sudo apt-get update
    sudo apt-get install software-properties-common
    sudo add-apt-repository ppa:certbot/certbot
    sudo apt-get update
    sudo apt-get install python-certbot-nginx 
    sudo certbot --nginx
    sudo certbot renew --dry-run

littlecornerjapan's People

Contributors

thanhtungka91 avatar

Stargazers

 avatar  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.