Skip to content

clarkfyr/Calumni

Repository files navigation

Calumni: Student-Alumni-Network-App

Maintainability

Test Coverage

Build Status

Instructions for environment setup

  • Development

    • It is recommended to deploy this project locally instead of on cloud9, as elasticsearch cost much memory and you may not have access to port 9200 on cloud9.
    • bundle install --without production
    • rake db:migrate
    • rake db:seed
    • export GOOGLE_CLIENT_ID=xxx
    • export GOOGLE_CLIENT_SECRET=xxx
  • Testing:

    • rake db:seed RAILS_ENV=test --trace
  • Production:

    • heroku
      • setup environment variable for aws
      • setup environment for elasticsearch
  • Search feature

    • We use gem Searchkick to implement search function, while Searchkick supports the complete Elasticsearch Search API. You have to install elasticsearch before you can use searchkick.
    • ElasticSearch Installation
      • Installation, currently using 5.6.4
      • For macOS user, use brew
        • brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/3f9a5fc50e42f6bdd17f955419c299653a0f65b9/Formula/elasticsearch.rb
      • use curl -XGET 'localhost:9200/?pretty' to make sure you have start elasticsearch service
    • use 'rake searchkick:reindex CLASS=People' to build the index
    • use People.search("xxx" ,autocomplete:true,fields:[:username,:company]).map{|u| {username:u.username,company: u.company}} to make sure your searchkick works
    • deploy to heroku
      • activate one of the elasticsearch provider like bonsai
      • connect searchkick with bonsai
        • heroku config:set ELASTICSEARCH_URL=heroku config:get BONSAI_URL
      • heroku run rake searchkick:reindex CLASS=People
      • heroku run rake db:migrate
  • Image/file upload

    • We use gem paperclip to support image upload and store them locally in development mode.
      • run sudo apt-get install imagemagick to install related library.
    • On heroku, we store images/files on AWS s3.
    • Setup AWS
      • create an s3 bucket

      • setup environment variable for AWS

         heroku config:set S3_BUCKET_NAME=project_name
         heroku config:set AWS_ACCESS_KEY_ID=key_id
         heroku config:set AWS_SECRET_ACCESS_KEY=key
         heroku config:set AWS_REGION=region