Anand Padia

Joined

1,300 Experience
10 Lessons Completed
0 Questions Solved

Activity

Posted in Hatchbox.io redirecting subdomains to https

Hey Masud.. here is what we have done. We have 2 nginx sites-available files.. look for /etc/nginx/sites-enabled/

1st - SSL_Enabled - Standard Hatch file - Listening to port 80 and 443
2nd - Subdomains - ningx server block - listening to just port 80
server {
  listen 80 default_server;
  listen [::]:80 default_server;

  server_name _;

  passenger_enabled on;
  rails_env    production;
  root         /home/deploy/YOURAPPFOLDER/current/public;

  # Allow uploads up to 100MB in size
  client_max_body_size 100m;

  location ^~ /assets/ {
      gzip_static on;
      expires max;
      add_header Cache-Control public;
    }

  location /cable {
    passenger_app_group_name YOURAPPFOLDER_websocket;
    passenger_force_max_concurrent_requests_per_process 0;
  }

  # redirect server error pages to the static page /50x.html
  error_page   500 502 503 504  /50x.html;
  location = /50x.html {
      root   html;
  }
}

now to enable non ssl sites we would have to remove subdomains from ssl routing.. edit /etc/nginx/snippets/ssl.conf and change the line as below

before:
add_header Strict-Transport-Security "max-age=15768000; includeSubdomains; preload";

after:
add_header Strict-Transport-Security "max-age=15768000; preload";

run service nginx reload and you should be good..

BTW - sites-enabled and ssl.conf will be write protected hence use sudo vim . to access and write to them.. 

let me know if this worked for you..
Hi Guys,

We have an application which has about 250+ websites running on it. However post we deployed SSL on these website our Nginx Reload has slowed down a lot. We are now facing situation where if we have to update anything to the Rails application we can only do it in the night to avoid any complaints from our customers. 

However the situation is getting worse for us, we have got customers creating website using our application more often.. on the business side we are loving it however our setup automatically generates a SSL for the website using certbot and restart's the server. Because of these restarts our customers are now feeling that we are not giving proper service. 

Is there anyone who has faced this issue.. and is there a solution available. Details of our setup is mentioned below for your reference.

Rails - 4.2.6
Ruby - 2.3.3
Nginx version: nginx/1.12.2
Phusion Passenger 5.2.0
Digital Ocean Droplet - 16 GB Memory / 320 GB Disk / Ubuntu 16.04.2 x64

Please help.

Regards,
Andy

Posted in Looking for Rails work? / Hiring Rails developers?

Seeking VueJS Developers with Ruby on Rails Expereience for an ongoing Project.

We need to convert the Vue JS + Magento Opensource project to simple VueJS template.

Repo: https://github.com/DivanteLtd/vue-storefront

Divante team has worked out a amazing setup which works beautifyfully with Magento API. We need this setup to consume our Rails API hence need help to make this template simple for us to understand and modify as need be. We are trying to run this as a simple proof of concept.

Our Requirement - Front End Only:
Simplify Vue-Storefront project(https://github.com/DivanteLtd/vue-storefront) - just Design, strip Magento API Connects.
Provide Notes to change themes and grid setup, to allow our beginner Vue JS developers to work out multiple templates.
Remove the API end points and create raw JSON Datasets.

Posted in Logger.debug to output command line results

Thanks Chris, I was able to get required result on logs.

Posted in Logger.debug to output command line results

I have an application where we have multiple domains mapped to same server and we need to create letsencrypt certificate for each of these domains. Along with this we need to create nginx files to accomany them..

I have successfully worked out a strategy to create nginx files dynamically from the ui based off user's input however when it comes to checking logs it is not that clear.. BTW we are using sidekiq with rails..

I am looking to see if there is a way to show the out of the command in rails logs..

Code for the custom class/service created..

command_to_run = "certbot certonly --non-interactive --webroot -w /home/deploy/.letsencrypt" + domain_info + " --email myemail@email.com --agree-tos --expand"
system(command_to_run)

if I run this command on terminal the output is ...

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Starting new HTTPS connection (1): acme-v01.api.letsencrypt.org
Cert not yet due for renewal
Keeping the existing certificate
so on....

how can I show this output in logs to check if the command ran properly and certificates were generated appropriately.

Posted in Why rails is not using msgpack?

I was trying to find a way to get better performance out on our solution and I thought that there is a possibility to ge data rendered in smaller bits than json. My research lead me to this article.. https://maxondev.com/serialization-performance-comparison-c-net-formats-frameworks-xmldatacontractserializer-xmlserializer-binaryformatter-json-newtonsoft-servicestack-text/

As per this msgpack seems to be the fastest, however there is not much on its utilization on rails. I checkout the https://github.com/jingweno/msgpack_rails gem for rails to get started however not much info on making this as default for rails application.

Also there are no benchmarks available on this side of comparision for rails, it seems rails is biased on using json/yml.

Please share your inputs on utlization other data conversions at the time of serializing for better performance. BTW, Chris it would be great if you can take up this topic and shed some light. I am not sure if it would benefit all however people who are dealing with lot of data this definately may help.

Posted in EAV Rails way?

Thanks for the response on this, I am using Rails 4.2.6 with Ruby 2.3.3. Jsonb seems to be interesting and i would try that out. I will share the results.. Thanks Jacob & Chris for your inputs.

Posted in EAV Rails way?

Hi Team,

I was trying to explore possibility of using EAV (Entity-Attribute-Value) pattern in our application. We are a ecommerce solution and would need Product variants to be captured, I did some quick research and found 2 gems claiming to do it right.

https://github.com/iostat/eav_hashes
https://github.com/kostyantyn/hydra_attribute

Has anyone used them.. Also do we have any reference videos available on them.

Posted in Rail API Knock User Authentication

Application Strucutre
Rails API
user model & controller - CRUD
blog model & controller - CRUD
comments model & controller - CRUD

Standard Blog App with Knock Authentication for access Token - followed https://gorails.com/episodes/api-auth-with-json-web-tokens-and-knock

Client side App
*Rails App *
Static Pages
Blog access via API

We are using Rest-Client gem to render the Blogs from API, to get this working we have created a user controller which connects to Blogs API CRUD, now we are able to get user token and use that on subsequent calls however I am not sure how to save this token on client side.

Is there a example available which shows how the Access token can be dealt with on the client side.

I have built the API with user authentication via Knock.
I am now trying to build a seprate Rails app which would consume this API however I am lost as to how the token would be saved client side.