HAProxy as a reverse proxy for cloudinary images Dec 05, 2016 We are using in one of our applications Cloudinary to host and resize images on the fly. We are also using Cloudflare for our CDN and DNS management. I was given a task to setup a CNAME subdomain in CloudFlare to forward the request to Cloudinary. This way we can still have the benefit of serving static images from CDN as well as reducing the Cloudinary bandwidth usage. My solution is to set HAProxy as a reverse proxy which responsible to fetch images from Cloudinary server. ...
HAProxy and A/B Testing Apr 13, 2016 Few weeks ago, I was given a task to create an A/B test using HAProxy. I need to make HAProxy to split traffic between two different applications ( Rails and NodeJS ) In this blog post, I’ll explain how to achieve this. Create ACL for the page you want to A/B test The first step you have to do is to create an ACL for the URL you want to A/B test. ...
Create new user on Amazon AMI and give it root access Mar 09, 2016 Setup your new EC2 instance on AWS and choose Amazon AMI. SSH to your instance using your private key ssh -i <path-to-your-pem-file> ec2-user@<ec2-endpoint-or-ip> Change to root sudo su Create new group for your user ( in this case my group name is ‘dev’ ) groupadd dev Create new user and assign it to your recently created group useradd -g dev dev Give the username root access ...
Import JSON to Elasticsearch using jq Feb 16, 2016 This is based on http://kevinmarsh.com/2014/10/23/using-jq-to-import-json-into-elasticsearch.html Install jq first on Mac brew install jq Import the JSON file to Elasticsearch index cat file.json | jq -c '.[] | {"index": {"_index": "bookmarks", "_type": "bookmark", "_id": .id}}, .' | curl -XPOST localhost:9200/_bulk --data-binary @- Check for the list of indexes http://localhost:9200/_cat/indices?v See the list of records http:/localhost:9200//bookmarks/_search
Reopen Last Commit in Git Jan 20, 2016 Run the command below if you want to reopen the last commit in your git 1 git reset --soft HEAD~ This is useful if you miss something in your last commit. Instead of creating new commit and squashing it, you can open last commit and fix it there.
Copying Files Between Two S3 Buckets Oct 16, 2015 Today, I have to copy files from one S3 bucket to another S3 bucket which sitting in separate AWS account. Initially, I was thinking to use S3 clients ( Tranmit or Cyberduck ) to download the files first and manually upload the files again to the other S3 Bucket. However, this approach will consume a lot of bandwidth and really slow if you have a lot of files in your S3 bucket. ...
Create SSH Tunnel To Backup PostgreSQL Database Aug 31, 2015 Today, I was trying to create a backup of production database. The problem is we have two different version of PostgreSQL running on production and these databases can only be accessed from front end(FE) server. We have older version of PostgreSQL client installed in all FE server which means I can’t use it to run pg_dump. SSH Tunnel to the rescue One solution to this problem is to create a SSH tunnel. ...
Rails Engines and Vim May 03, 2015 At the moment, I am working on a Ruby on Rails projects using Rails Engines ( you can read more about Rails Engines here: http://guides.rubyonrails.org/engines.html ). In this post, I’ll share my tips and trick on how to configure your vim to work with Rails Engines. NERDTree Bookmark I am using NERDTree Bookmark to quickly jump between different engines. If you are using NERDTree, you can create a bookmark by putting your cursor on one of the Rails Engines directory and use the command below: ...
Symbolic Links With Vagrant Windows Oct 27, 2014 There are few known limitations when using Vagrant on Windows machine. One of these limitations is the lack of symbolic links support on synced folder. Symbolic links are used heavily by NPM to create shortcut for the libraries. I posted more details about this here: http://blog.rudylee.com/2013/10/24/fix-npm-symlink-problem-in-vagrant/ Most of the time, you can get away with ‘npm –no-bin-link’ solution. However, you need more robust solution if you are using complex tools such as Grunt or Yeoman. ...
Enable HTTP authentication on certain domain Sep 18, 2014 Basic HTTP authentication is one simple way to limit public access to your website prior to launch. The first thing you need is .htaccess file which contains all the configurations. The second one is .htpasswd containing username and password. You can use this website to generate .htpasswd file for you http://www.htaccesstools.com/htpasswd-generator/ In the sample below, I am trying to enable HTTP authentication only on certain domain. On the first line, I set enviroment variable if the domain name is equal to “www. ...