Ask A Question

Notifications

You’re not receiving notifications from this thread.

Getting data from one Rails app to another

shakycode asked in General

I'll try to keep this as brief as possible.

I have a Rails app which is a static codebase and runs on 9 different servers all the same db schema but of course with different values.

I wrote some SQL to query some dollar totals and will be putting this into either a rake task or a sidekiq worker and have it fire once a week to generate the data. Initially I was thinking of just throwing the resulting data from each server into a mailer and mailing it to whoever needs the data. This is pretty straight forward.

But there's a kink in this, we need to see metrics over time in highcharts or some other charting engine.

So here's my thought.

  • Create the sidekiq worker and fire it on a schedule
  • Take the resulting data from each server and populate it on a target server via Postgres (not sure how to do this)
  • The target server will have a very simple Rails app built that will have a model with metrics and an association for each server (ie server 1 server 2 etc), after populating the data via postgres (somehow) from the source servers, read the data in HighCharts and present the view

So that's my thought process so far. I'm not sure on how to get the data from the source servers via a live postgres call when the sidekiq worker fires. So that's problem #1. Problem #2 or more like question #2 is, would this be a better use case for creating some sort of consumable API on the target Rails server? If so, what's the best place to start.

If my question and thought process is unclear, please let me know so I can clarify and explain in better detail.

Cheers!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,329+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.