deploying multiple servers that communicate with each other, best practices - ruby-on-rails

Say I have:
a Rails app that I want to deploy to Server A
a Sinatra app that I want to deploy to Server B
the Rails app needs to communicate with the Sinatra app
I can set up a config file that Capistrano reads to deploy both apps. I can put a config file on Server A that the Rails app reads telling the Rails app that the Sinatra app on Server B. But is there a best-practices way to automate this whole process?
thanks in advance, Chuck

The best way to go for this is using messaging.If you don't know it's a technology for managing asynchronus services( aka apps).
It means that even someone you has lot of apps like you do messaging make them talk to each other, and if one of them break, the messaging technology will put the data on a queue so it'll not be lost.
There's several source of information for messaging.But first of all I advice you to pick
Paul dix's book which is a major source of information to get start.
Also go to Rabbitmq which is one of the most advanced messaging technology out there.
But remember that your configuration will need much work upfront.But once it's done you'll cool.
That was my humble contribution.
Ps: I'm not an expert, as you I'm trying to implement this kind of architecture too.

Related

How I can compare two iOS local web-servers?

I created an iOS app prototype that runs two web servers (CocoaHTTPServer and GCDWebServer). And I want to choose the best one.
I need to use a local web-server as a backend for JS-application (Will God Forgive Me?) that will shown in WKWebView in this application.
So, can you please suggest me, how I can compare the perfomance of these two servers?
Which kind of tests should I perform and how?
What are the indicators I should pay attention to?
I would recommend GCDWebServer, as it is actively supported (though mature and stable). To the best of my knowledge CocoaHTTPServer is not currently being actively maintained.

Rails : Deploy using GoDaddy.com

I know this is a topic which is very delicate however the simple question is.... has anyone uploaded a rails app using godaddy.com and if so how did they do it. I'm literally clueless. This is my first time. I cannot use anything else due to my clients choice.
If you're looking for shared hosting, Heroku is your best bet. Although you will need to make some minor modifications to your application to fit this environment, the benefits are considerable.
I would not recommend using regular shared hosting, which is primarily intended for PHP applications, for Rails. You need a VPS at the very least, and if you're not prepared to manage this, you need a managed environment like Heroku or you'll end up in serious trouble.
For small scale or hobby projects, a 512MB VPS is usually sufficient to get started.
If your client is insisting on GoDaddy, Rails may not be a good choice for you. It does seem possible according to the documentation but you need to have the correct account type.

Server Environment

I am trying to develop an iOS application that stores and loads data to and from a server. The data needs of the client can be pretty much narrowed down to REST. MY question is, is REST something widely used for data/server driven iOS applications? is there a paradigm proven better or more suitable for iOS apps?
if REST is the way to go, what server environment would you choose? what server side Technology? PHP? Java? something else? We'd set up a test/dev environment at first, but eventually we are going to deploy on services like Amazon cloud or any other hosting/cloud service.
Any insight will be most welcome.
So are you writing the backend too?
Most projects that I've worked with in the past few years use REST. It's made little difference in the implementation of the iOS app (I think...). I'm more concerned about the type of data I'm consuming, which is usually JSON - and ensuring that it is as lean as possible. People writing web services should be concerned about REST.
I've also worked with projects this year that use different technologies on the backend. Java on one, and Ruby on Rails on the other.
I know another guy who uses PHP on one project, and Ruby on another.
If I was to do a backend, I'd probably use Java - solely because I know it. Not the best excuse to pick a technology - but as a full time iOS developer, I don't have time to learn something new that I won't use very often.
If you are going to deploy on a cloud based service, see what technologies they support. Maybe picking the common denominator would be a wise choice to keep your options open. Some languages tend to have more expensive server hosting costs. Java is usually more expensive than PHP to host, I guess due to the complexities of running shared java VM's instead of PHP interpreter.

References for web application scalability and deployment best practices

I find it easy to find resources on amazon/online to learn new frameworks/programming languages. However, when it comes to web app deployment, I find it really hard to find a single resource that explains all. Most of them just tell you what to do without explaining 'why'.
I just did my second rails app deployment with unicorn and nginx. Although I 'kind of' know what is going on when reading the tutorial, I would like to know more about the 'how' and 'why' of the steps that were given.
In short, I would like to read books/articles/tutorials (hopefully all-in-one) about best practices for web app deployment, and how to scale/load-balance your app when it gets more traffic (and hopefully it the tutorial uses NGINX/unicorn setup).
Well, deployment and scaling are completely orthogonal topics, so I don't think you'll find an article/tutorial that covers both.
As for deployment, you better automate your work. When you deploy to 100+ servers, the last thing you want to do is to do it manually (fetch from git, migrate db, restart servers, etc).
Capistrano - very well known and adopted tool for deploying Rails.
Vlad - another tool that gains more attention lately.
Chef - very powerful tool for server management. Several top Russian sites use it.

Integrating Django and Rails

I have an app written in `RAILS' and i want to add few features to the project but i feel like using django to write those features since i am more comfortable in Python/Django.is there any way i can write the app in django and tel Rails server to handle the request to forward the request once django part user is clicked.
The only idea I have in mind to make this work is for the Django app to provide an API that the Rails app could use. But why would you want to mix the two up? I don't think this is a good idea. Besides using Django only to write certain features is under utilizing it.
If there truly was benefit to introduce an entirely new stack into your environment (personally I question that benefit but you certainly more about your requirements more than I do), I'd go the path of messaging versus a more service driven approach. Going with messaging will better insulate your systems from each other and give you a lot more flexibility which will come in handy as both systems evolve.

Resources