Yearly Archives: 2011

HTTP basic authentication in rails to protect staging server

Sometimes, you may need to protect your staging server from outside world. It can be done easily by using http basic authentication in rails3. I did following things to use HTTP basic authentication to protect my staging server: YML file with username and password pair: devuser: devpasstestuser: testuserpass Loaded YML data from application initializer: HTTP_AUTH_USERS…

Read More

Rails application deployment using shell script

I have used following shell script to deploy one of my Ruby on Rails applications: DATES=`date +%Y%m%d%H%I%S`service apache2 stop &&mysqldump -u[user] -p[pass] [yourdbname] > “your backup directory”[yourdbname]_${DATES}.sqlgit pull &&bundle install –path [your bundle path] &&bundle exec rake db:migrate RAILS_ENV=production &&mv [your application’s production log file] [your application’s production log backup path]/production_${DATES}.log &&touch [your application’s production…

Read More

LF will be replaced by CRLF

I was getting following message while trying to add files to GIT index: Warning: LF will be replaced by CRLF …. By google search I found that – whenever tried to add files to the repository, git thinks that, the file is a text file and all files automatically will have their LF line endings…

Read More