
1. It is absolutely free

2. Ruby on Rails is the master

3. Order management

4. Advanced Tools, Features, and Integration

5. The community is amazing

gem 'devise_cas_authenticatable', git: '<a href="https://github.com/jpamaya/devise_cas_authenticatable">https://github.com/jpamaya/devise_cas_authenticatable</a>'routes.rb
devise_for :users, skip: [:sessions], controllers: { cas_sessions: 'sso_cas' } devise_scope :user do get "sign_in", to: "devise/cas_sessions#new" delete "sign_out", to: "devise/cas_sessions#destroy" enddevise.rb # ==> Configuration for SSO server authentication
config.cas_base_url = "http://localhost:4000/" config.cas_create_user = false config.cas_destination_logout_param_name = 'service' config.cas_enable_single_sign_out = trueUser.rb
devise :cas_authenticatableNow run client application on localhost:3000 and begin with typing users/sign_in Since we overwrote devise’s sign in mechanism, so instead of presenting devise’s normal sign in page, we are redirected to localhost:4000 which is the backend app to authenticate the users. Lets prepare the backend app to authenticate the users. Step #2 Start with implementing code in server app limitation use ruby ruby “2.1.5” and rails “3.2.11” check rails -v ‘~>(‘ 3.2.11’). for server app Gemfile #It users these db to store sessions and some tokens. casino will take care all about these
gem 'sqlite3' # for sqlite support gem 'mysql2' # for mysql support gem 'pg' # for postgresql support gem 'casino'Run bundle install and rails g casino:install The CAS configuration is stored under config/cas.yml. This is where you configure how your SSO handles logins. An example configuration can be found in the file config/cas.yml.example provide the valid db credentials and run the migrations. Run this app on localhost:4000 , Just follow the old steps
Server exampleruby “2.1.5”git clone https://github.com/codescrum/casino-sso-server-example.gitRails 4 client examplegit clone https://github.com/codescrum/casino-sso-client-rails4-example.gitRails 3 client example git clone https://github.com/codescrum/casino-sso-client-rails3-example.git |
Rails applications are a little bit different to install on servers but the process is very easy.Rails application needs a web server and an application server to run with. For development, it comes with default Webrick server that serve as application server on local machine. For setting it up on production server, we have the following choices on Web and application servers :-
Web servers
Apache
Nginx
Application Servers
Passenger
Thin
Puma
Unicorn
The simplest and best combination consists of Nginx + Passenger. It allows greater flexibility for configuration and also allows good speed over other combinations. So we are going to setup an Rails application using Nginx + passenger configuration on a bare Ubuntu server. Here are the steps :-
Launch an Ec2 instance with ubuntu AMI. Make sure you have HTTP and SSH access to the server.
SSH into the server by using private key (.pem) used while launching the instance and install the available updates by running :-
sudo apt-get install updates
Load the rvm and make the installed ruby as default by running the following commands :-
source ~/.rvm/scripts/rvm
rvm use 2.1.0 –default
Install the version control to clone your rails application to server. We generally use Git with rails application which can be installed by running the following command :-
sudo apt-get install git
Now clone your application on the server :-
git clone yourepo.git
Note:- In case of private git repository, you need to add public key of server to deploy keys of your repository, otherwise you will be promped with an permission denied error.
OR
Deploy using application to this server using Capistrano script. Please read this blog for more details on deploying your application using Capistrano.
Now go to your application and install the gems by running bundle install command. If you want to setup your database on the same server, you can do the same by using the following commands 😐
In case of MYSQL
sudo apt-get install mysql-server mysql-client
sudo apt-get install libmysql++-dev
In case of POSTGRESQL, follow this blog for installation and then install the development headers
sudo apt-get install libpq-dev
After setting this up, migrate your databases in whichever environment you want to launch the server.
gem install passenger
Next step is to install the Nginx server, but we have some pre-requisits for this.
It needs curl development headers which can be installed by :-
sudo apt-get install libcurl4-openssl-dev
It will be installed under /opt directory and your user should have permissions to that folder, so make your user as user owner for /opt directory by :-
sudo chown -R ubuntu /opt
Now install the Nginx server with passenger extension by running the following command :-
passenger-install-nginx-module
Set your Nginx server as service in init script by using the following commands :-
wget -O init-deb.sh
http://library.linode.com/assets/660-init-deb.sh
sudo mv init-deb.sh /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults
Setup your application path in the nginx configuration file i.e.
/opt/nginx/conf/nginx.conf.
server {
listen 80;
server_name localhost;
root /home/ubuntu/my_application/public #<-- be sure to point to 'public'
passenger_enabled on;
rails_env production;
}
Lastly start your server by running the following command :-
sudo service nginx start
</pre> <h1>Braintree Credit Card Transaction Form</h1> <div><form id="braintree- payment-form" action="/create_transaction" method="POST"><label>Card Number</label> <input type="text" autocomplete="off" size="20" data-encrypted-name="number" /> <label>CVV</label> <input type="text" autocomplete="off" size="4" data-encrypted-name="cvv" /> <label>Expiration (MM/YYYY)</label> <input type="text" name="month" size="2" /> / <input type="text" name="year" size="4" /> <input id="submit" type="submit" /></form></div> <pre>Next up, we need to encrypt the payment that is being sent from client side to our server for processing. Braintree provides a nice JS library to encrypt the data that is being sent from your form. The integration is as simple as including the library and calling a do it all method.
<script type="text/javascript" src="https://js.braintreegateway.com/v1/braintree.js"></script><script type="text/javascript">// <![CDATA[ var braintree = Braintree.create("YourClientSideEncryptionKey"); braintree.onSubmitEncryptForm('braintree-payment-form'); // ]]></script>As you can see, we just did couple of steps to secure the data being sent to the server.
Braintree::Configuration.environment = :sandbox Braintree::Configuration.merchant_id = “use_your_merchant_id” Braintree::Configuration.public_key = “use your public key” Braintree::Configuration.private_key = “use your private key”
result = Braintree::Transaction.sale(:amount => “1000.00”, :credit_card => {:number => params[:number], :cvv => params[:cvv], :expiration_month => params[:month], :expiration_year => params[:year]}, :options => {:submit_for_settlement => params[:settlement]})
gem 'aws-s3', :require => 'aws/s3' gem 'aws-sdk'
class Post < ActiveRecord::Base attr_accessible :avatar has_attached_file :avatar, :styles => { :medium => "300x300>"}, :storage => :s3, :s3_credentials=>{:access_key_id=>"AWS_ACCESS_KEY_ID", :secret_access_key => "AWS_SECRET_ACCESS_KEY"}, :s3_permissions => "public-read", :path => ":id", :bucket => "AWS_BUCKET" end
Join Us