Posts

Showing posts from 2018

AWS EC2 INSTANCE, ASSOCIATE ELASTIC IP, RDS AND ELASTIC BEANSTALK

IF WE WANT TO CREATE EC2 INSTANCE and MAP WITH ELASTIC IP OR WANT TO CREATE RDS and DEPLOYMENT WITH ELASTIC BEANSTALK : - SO THESE BELOW LINK WILL HELP YOU  Now I have tried the below attempts:     1.   Increase EC2 Instance RAM :-                                                                                                                         https://www.youtube.com/watch?v=YCI5sehyDNc     2.   Map with elastic IP :-                                                                                                                                              https://www.youtube.com/watch?v=mgfpduy5ZAo            https://www.youtube.com/watch?v=A3F2vIQYlu8     3.   Difference between Elastic IP, Public IP and Private IP:                                                                                           https://www.youtube.com/watch?v=MTBR9jyD5RM     4.   AWS Instance Pricing :-                                                          

RECURRING PAYMENT IN STRIPE, SUBSCRIPTION PAYMENT IN STRIPE RAILS

Image
Using Recurring Payment (Subscription Based)  Rails Quickly integrate Recurring payment into your Ruby on Rails-based site to provide your users with a streamlined, mobile-ready payment experience. Getting started The first step is adding the Stripe gem to your application’s Gemfile: gem 'stripe' Then, run bundle install to install the gem. https://dashboard.stripe.com/account/apikeys Create config/initializers/stripe.rb : Rails.configuration.stripe = {   publishable_key: Rails.application.secrets.stripe_publishable_key,   secret_key:      Rails.application.secrets.stripe_secret_key } Stripe.api_key = Rails.configuration.stripe[:secret_key] We will use testing keys for the development environment. For production environment you need to configure with live keys to receive real payments. Add these keys at config/secrets.yml : development:   stripe_publishable_key: pk_test_xxxxxxxxxxxxxxxxxxxxxxxx   stripe_secret_key: sk_test_xxxxxxxxxxxxxxxxx

STRIPE IN RAILS, CHECKOUT PAYMENT WITH STRIPE IN RAILS

Image
Using Checkout and Rails Quickly integrate Checkout into your Ruby on Rails-based site to provide your users with a streamlined, mobile-ready payment experience. Getting started The first step is adding the Stripe gem to your application’s Gemfile: gem 'stripe' Then, run bundle install to install the gem. Create config/initializers/stripe.rb : Rails.configuration.stripe = {   publishable_key:  Rails.application.secrets.stripe_publishable_key,   secret_key:          Rails.application.secrets.stripe_secret_key } Stripe.api_key = Rails.configuration.stripe[:secret_key] We will use testing keys for the development environment. For production environment you need to configure with live keys to receive real payments. We can create the Stripe api keys from :-  https://dashboard.stripe.com/account/apikeys Add these keys at config/secrets.yml : development:   stripe_publishable_key: pk_test_xxxxxxxxxxxxxxxxxxxxxxxx   stripe_secret_key: sk_test_xxxxx

CURL COMMAND ON RUBY ON RAILS

HOW TO USE CURL ON RUBY ON RAILS? LIKE THIS ONE curl - d 'params1[name]=name&params2[email]' 'http://mydomain.com/file.json' Just in case you don't know, it requires 'net/http' require 'net/http'   uri = URI . parse ( "http://example.org" )   # Shortcut   #response = Net::HTTP.post_form(uri, {"user[name]" => "testusername", "user[email]" => "testemail@yahoo.com"})     # Full control   http = Net :: HTTP . new ( uri . host , uri . port )   request = Net :: HTTP :: Post . new ( uri . request_uri )   request . set_form_data ({ "user[name]" => "testusername" , "user[email]" => "testemail@yahoo.com" })   response = http . request ( request )   render : json => response .body Hope it'll helps others.. :) We can also follow the link below :- https://stackoverflow.com/questions/15804425/curl-on-rub

RUN RAILS SERVER ON PORT 443

If we want to run the rails application in port 443 :- I have added the below line in /config/environments/production.rb: config . force_ssl = true Now I have tried the below attempts: Start rails on 3000 SSL=true rails s -e production -p 3000 It runs rails on  https://project.com  but 404 error on  http://project.com Start rails on 443 and mentioned the same port in script: rvmsudo rails s -p 443 Start rails on 80 and 443 both using two different pid: rvmsudo rails s -p 80 -P PID1 rvmsudo rails s -p 443 -P PID2 4.Finally I have tried to forward request to 3000 from 443 and 80: sudo iptables - t nat - I PREROUTING - p tcp -- dport 80 - j REDIRECT -- to - ports 3000 sudo iptables - t nat - I PREROUTING - p tcp -- dport 443 - j REDIRECT -- to - ports 3000  We can also follow the link below :- https://stackoverflow.com/questions/27560744/run-rails-on-secure-https-and-redirect-non-securehttp-request-to-secure-thro