Coder Social home page Coder Social logo

sahrxvision / ruby_website Goto Github PK

View Code? Open in Web Editor NEW

This project forked from code-and-effect/effective_website

0.0 0.0 0.0 846 KB

A ruby on rails starter website that uses the effective_gems.

Home Page: https://effective-website-demo.herokuapp.com/

Shell 0.32% JavaScript 2.16% Ruby 77.73% HTML 2.63% Dockerfile 0.24% Haml 16.06% SCSS 0.86%

ruby_website's Introduction

Effective Website

This is a rails starter website that uses most of the effective_* gems.

Ruby 2.7.1 Rails 6.1

Live Demo

Click here for a Live Demo.

Login as [email protected] with password example.

Getting Started

git clone git@github.com:code-and-effect/effective_website.git

cd effective_website
cp .env.example .env  # Fixes SECRET_KEY_BASE errors

bundle install
yarn install

rails db:create db:migrate db:seed
rails server

Login as [email protected] with any password.

  • Search the entire project for 'example' and fill in your site specifics.
  • Good luck!

Run tests with

rails test
rails test:system

rails test:bot:environment
rails test:bot:system

Docker

You can also use Docker to install and run this site:

cp config/database.yml.docker config/database.yml
docker-compose build

# One time
docker-compose run web bash
rake db:create db:migrate db:seed
exit

# And then, each time
docker-compose run web

Heroku

When deploying to heroku, we need to use two build packs.

To configure heroku, run the following (one time only):

heroku buildpacks:add --index 1 heroku/nodejs
heroku buildpacks:add --index 2 heroku/ruby

Amazon S3

If you want to use Amazon S3 for ActiveStorage

Uncomment amazon in config/storage.yml and add ENV variables.

Change config.active_storage.service to :amazon in one or more config/environments/ files.

Log into AWS Console

Create an S3 Bucket

  • Click Services -> S3 from the top-left menu
  • Click Create Bucket
  • Give the Bucket a name, and select the US East (N. Virgina) region.
  • Click Next, Next, Next
  • Don't configure permissions yet, we still have to create a user
  • Click Next

Configure CORS Permissions

  • From the S3 All Buckets Screen (as above)

  • Click the S3 bucket we just created

  • Click the Permissions tab

  • Click CORS configuration and enter the following:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>GET</AllowedMethod>
    <MaxAgeSeconds>3000</MaxAgeSeconds>
    <AllowedHeader>Authorization</AllowedHeader>
</CORSRule>
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>PUT</AllowedMethod>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>
  • Click Save

The Bucket is now set up and ready to accept uploads, but we still need a user that has permission to access S3

Create an IAM User and record its AWS Access Keys

  • After logging in to your AWS console

  • Click Services -> IAM from the top-left

  • Select Users from the left-side menu

  • Click Add user

  • Give it a user name

  • Check Yes Programmatic access, No AWS management console access

  • Click Next: Permissions

  • Click Create group

  • Give it a name like 's3-full-access'

  • Scroll down and select 'AmazonS3FullAccess'

  • Click Create group

  • Click Next: Review

  • Click Create user

  • Record the Access key ID and Secret access key.

Copy these values into your .env file.

This user is now set up and ready to access the S3 Bucket previously created.

Omniauth

We support omniauth oauth2 authentication via Google, Facebook, Microsoft and other omniauth providers.

https://www.sitepoint.com/rails-authentication-oauth-2-0-omniauth/

Facebook oAuth2

FACEBOOK_APP_ID=
FACEBOOK_SECRET=

Google oAuth2

  • Add gem 'omniauth-google-oauth2' to Gemfile and bundle.

  • Visit https://console.developers.google.com

  • Click 'New Project' and give it a name

  • Open 'APIs' 'Library' section and make sure Google+ API is enabled

  • Click 'OAuth consent screen' and create the oAuth application

    • External
    • Fill in Application Name
  • Click the 'Credentials' side bar item

GOOGLE_CLIENT_ID=
GOOGLE_SECRET=

Microsoft oAuth2

MICROSOFT_APP_ID=
MICROSOFT_SECRET=

License

MIT License. Copyright Code and Effect Inc.

Testing

rails test
rails test:system
rails test:bot:environment
rails test:bot

rails test:system TOUR=true
rails test:bot TEST=admin/clients#index

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Bonus points for test coverage
  6. Create new Pull Request

ruby_website's People

Contributors

matt-riemer avatar danajanssen avatar mrbiggred 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.