Posts

Showing posts from February, 2016

Run sidekiq in proudction mode

##To Update cron bundle exec whenever --update-crontab ## To start Redis redis-server ##clear rediscache redis-cli flushall ## To Start Sidekiq in production env bundle exec sidekiq -d -L sidekiq.log -q mailer,5 -q default -e production ## compile assets rake assets:precompile RAILS_ENV=production

ActionCable Devise Authentication

ActionCable is a new framework for real-time communication over websockets and it will be part of Rails 5. I am not going to get into too much detail about it, you can read the very detailed readme of the project on this link: ActionCable . The websockets server is running in a separate process from the main Rails application which means you need to authenticate your users there too. In the example app , David used a simple cookie based authentication in the app itself and re-validated the cookie at the websocket connection. This is good for demonstration, but many of the Rails based apps are using Devise for authentication so I want to share, how I solved the authentication with Devise. The websocket server doesn't have a session, but it can read the same cookies as the main app, so I figured, I will just set a cookie with the user id and verify that at the socket connection. To do this, I used a Warden hook: # app/config/initializers/warden_hooks.rb Warden ::

Conver mysql .sql file in to postgreql .psql

1. mysqldump --compatible=postgresql --default-character-set=utf8 -r marketacreative.mysql -u root marketacreative 2. python db_converter.py marketacreative.mysql marketacreative.psql Get db_converter.py from https://github.com/lanyrd/mysql-postgresql-converter 3. psql -U root -h localhost -d marketacreative -f  marketacreative.psql