Posts

Showing posts from December, 2017

Deploy Ruby On Rails application on production AWS Ec2 server

1. Give 400 permission to pem file. sudo chmod 400 example.pem 2. Login on server.  ssh -i  example. pem file ubuntu@ip_address ------------------------------ ------------------------------ ---------- 3. You can check ubuntu server details by: lsb_release -a No LSB modules are available. Distributor ID:    Ubuntu Description:    Ubuntu 16.04.2 LTS Release:    16.04 Codename:    xenial ------------------------------ ------------------------------ ---------- 4. Install the required libraries: sudo apt-get update sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev nodejs yarn sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev gpg --keyserver hkp:// keys.gnupg.net  --recv-keys 409B6B1796C275462A1703113804BB 82D39DC0E3 curl -sSL  https://get.rvm.io  | bash -s stable source

Integrate faye gem on server with nginx

I was getting follwing error on server. ActionView::Template::Error (Failed to open TCP connection to localhost:9292 (Connection refused - connect(2) for "localhost" port 9292)) It can be fixed by following options: sudo nano /etc/nginx/sites-available/default location /faye {     proxy_pass  http://localhost:9292 ;      proxy_set_header Host $host;      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;      proxy_set_header X-Real-IP $remote_addr;      proxy_connect_timeout 90;      proxy_send_timeout 90;      proxy_read_timeout 90;      proxy_set_header X-Forwarded-Proto https;      break; } rackup  private_pub.ru  -s thin -E production -D

Failed to connect to localhost port 9200: Connection refused

From a fresh install of Ubuntu 16.04: sudo apt-get install elasticsearch After that, the following should work but doesn't: sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable elasticsearch.service sleep 10 curl  http://localhost:9200/ Despite that, the following does work: sudo -u elasticsearch /usr/share/elasticsearch/bin/elasticsearch & sleep 10 curl  http://localhost:9200/