Posts

SIGN UP ON FIRST PROJECT IT WILL AUTOMATICALLY LOGIN TO ANOTHER PROJECT SERVER

Sign up on first project it will automatically sign up to another project server In first server code :-Gemfile
gem 'rest-client'


Controller

def create
# sign up on one server
               @user = User.create(name: params[:user][:name], email: params[:user][:email], password: params[:user][:password], password_confirmation: params[:user][:password_confirmation])

# after login one server it will automatically on second server
               RestClient::Request.execute(method: :post, url: "https://ipaddress/domain/users", headers: {:params => {"user": {"name": "rohit", "email": "rohityuvasoft149@gmail.com", "password": "12345678", "password_confirmation": "12345678"}}}, verify_ssl: false)
    end
       end
In second server it will be sign up automatically.

UPLOAD ANY MEDIA FILE WITH CARRIER-WAVE RAILS

Image
UPLOADING ANY MEDIA FILE WITH CARRIER-WAVE RAILS Multiple file uploads Add it to your Gemfile:      gem 'mime-types'
      gem 'mini_magick'
      gem 'rmagick'
      gem 'carrierwave', '~> 1.0'
      gem 'carrierwave-video'
      gem 'carrierwave-video-thumbnailer'
      gem 'carrierwave-ffmpeg'
Run
      bundle

Start off by generating an uploader:app/uploaders/vimeo_uploader.rb      rails generate uploader Vimeo Check out this file for some hints on how you can customize your uploader. It should look something like this:class VimeoUploader < CarrierWave::Uploader::Base
storage :file
end
If we want to upload video or image then we will have to use :-class VimeoUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
      include CarrierWave::Video
      include CarrierWave::Video::Thumbnailer
      include CarrierWave::FFmpeg

      storage :file
     def store_dir
         "uploads/#{model.class.to_s.undersc…

RESTART THE DROPLET OR EC2 INSTANCE FROM COMMAND LINE

RESTART THE DROPLET OR EC2 INSTANCE FROM COMMAND LINE Login to your droplet or virtual console using ssh command :-Run the command :-

sudo shutdown -r now

We can follow the link below :-


https://www.digitalocean.com/community/questions/how-to-reboot-droplet-through-the-command-line-restart-apache-server

https://www.digitalocean.com/community/tutorials/how-to-use-the-digitalocean-console-to-access-your-droplet

SUDO: UNABLE TO RESOLVE HOST WEBSERVERNAME

sudo: unable to resolve host webservername For that:- We have to write the below line in /etc/hosts127.0.1.1 webservername



We can follow the link below :-

https://askubuntu.com/questions/59458/error-message-sudo-unable-to-resolve-host-user

CREATE API FOR USER SIGN UP, LOGIN AND CREATE PUBLISHER WITH CURRENT USER

Image
User Registration in Devise through API I have recently started developing REST APIs with rails 5. I am trying to do User crude actions through API calls. I have set up a basic devise for users.In my routes I have this: namespace :api do                                                                            
     namespace :v1 do                                                                         
         devise_scope :user do                                                               
            post 'signup' => 'registrations#create'                                   
            post 'signin' => 'sessions#create'                                          
            delete 'signout' => 'sessions#destroy'                                    
         end                                                                                          
         resources :publishers������������������������������������������…

COULDN'T CONNECT TO SERVER 127.0.0.1:27017 (START MONGO DB)

COULDN'T CONNECT TO SERVER 127.0.0.1:27017 START MONGO DB SERVER sudo rm /var/lib/mongodb/mongod.lock
mongod --repair
sudo service mongod start

OR WE CAN USE sudo rm /var/lib/mongodb/mongod.lock
sudo mongod --repair --dbpath /var/lib/mongodb
sudo mongod --fork --logpath /var/lib/mongodb/mongodb.log --dbpath /var/lib/mongodb
sudo service mongodb start


http://stackoverflow.com/questions/12831939/couldnt-connect-to-server-127-0-0-127017
WHEN WE UNABLE TO START MONGO DB THEN WE CAN FOLLOW https://stackoverflow.com/questions/9757925/upgrade-mongodb

ADDING SWAP TO AWS EC2 INSTANCE + MEMORY ALLOCATION PROBLEM

Adding Swap to Aws EC2 instance:-sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /var/swap.1
sudo /sbin/swapon /var/swap.1
If you need more than 1024 then change that to something higher. To enable it by default after reboot, add this line to /etc/fstab:swap        /var/swap.1 swap    defaults        0   0 To turn ON the swap do the following:swapon -a To turn off the swap do the following:swapon -a To turn off the swap do the following:sudo /sbin/swapoff /var/swap.1