Rails design multi client app - ruby-on-rails-3

I need some references for creating a Rails app where each client/company has his own database and using some control panel to admin his parameters.
I have used the setler gem, but I need some design advices.
What is the best practice to do this, guys?
(The decision of separating the databases is made by the big size of the data that they store)

Take a look at this:
http://www.rollcallapp.com/blog

Multi-client is also known as multi-tenant.
See also answers to this question:
Multi-tenant rails application: what are the pros and cons of different techniques?

Related

Is it possible to synchronize the ldap data in gluu with an rdbms?

I've been reading a bit about gluu. It uses an ldap or a couchbase backend. I need some of the user data (at least the immutable user identifier) to be replicated to an RDBMS (let's say postgresql).
Is it possible? Also, am I out to lunch trying to achieve this? Cas and keycloak offer the option to hook the product to an rdbms, so I would say no - but it might be an anti-pattern.
Thanks
It's possible to sync LDAP and SQL/others using LSC
You can also post your question in https://support.gluu.org to talk directly to the team for further details.

Creating Azure Environments for Country-Specific Data?

We have an iOS app where users can register, login, and generally do user-specific stuff. We are currently hosting it in Azure SQL DB and using other Azure Services such as Web Applications, Azure Functions etc.
If we want to scale the app for different Countries, we are aware that there are different data privacy concerns per Country. As such, should we be creating different Azure Environments for each country? And develop different versions of the iOS app to point to the specific Azure Environment to use?
Is this is the correct practice? Or is there a recommended pattern / approach for this?
Thank you!
It really depends on the requirement and the end customer, in some cases certain countries have common policies in place.
You can read and understand the best practices and Guidance for Data Controllers when you are migrating/implementing applications on azure

Trying to wrap my head around Custom Identity tables with a DB first approach

My entire group is new to ASP.Net Core and I was the lucky one tasked with Authentication/Authorization. We have always used a DB first approach, and this is no different, we already have our DB all set up. The higher ups want to use our specific tables for all things Identity, but they also want to leverage the tools that ASP.Net Core gives.
This will be a multi-site app where there is one central database. Our current setup is close to what the scaffolding adds, but has some small differences.
I have read a ton of resources, but the vast majority all focus on the code first approach and I currently don't fully understand what I need and what is there for the code first approach. I have seen a couple of answers that recommend using the .ToTable and .Property inside of OnModelCreate. Is this the best option or am I better off creating my own stores and methods? I currently have a user model created and a store to go with it (based on this site). Is it best for me to try to expand that all the way out (don't full understand how to have it pull in roles and claims).
This is what our DB Schema currently looks like.
At this point we are creating our Roles and Claims via a db script. The only thing we will be using UI's for right now is a page that will let a site admin add users, and assign them roles, and any singular claims they need.
Any help or input would be greatly appreciated as I try to wrap my head around all of this. If I have left out any pertinent information please let me know. As I said with what I have now I can create a user and login, I just have no idea where to go from here (how to add roles and claims).
Here's how I think about it and the steps I would take to approach in solving this problem.
So Microsoft's implementation of Identity is an abstraction of the problem.
The Models that they provide and the Tables that are derived from them is their choice for the default implementation of the abstraction.
So essentially what you want to do is to plug in your models in to this abstraction.
To quickly generate these models from your database you might want to use scaffolding this will generate the DbContext and the Models, you will then have to configure the dbcontext to plug in your design.
And if you look at how you can create your own Identity Tables providing your own objects
here this can give you an idea of how to plug in your models/functions in to this abstraction.
You will most likely have to override the OnModelCreating method to configure the relationship of your tables.

jhipster entity - what exactly is that?

I am wondering what jhipster entities are exactly?
What if I just want to create a new page/view without any database entry and relationship? For example: the about page, do I have to use the entity generator in order to create it? What are the benefits of it?
jhipster entity tutorial
Regards
redyar
Entities are typically objects that are backed by a database table. With JHipster, you can generate entities (and their associated screens) using Yeoman.
For an about page, or any other page, you can author them by hand. You don't need to use a generator. JHipster merely provides its entity sub-generator as a convenience for you.
You can also use the Yeoman generator for AngularJS to generate basic scaffolding.
http://yeoman.io
Immagine to build a website of e-commerce. That website contains users, sensible data informations, details about sellers and other things. You can save a lot of time creating it with Jhipster because it automatically create Objects class that represents database's tables, RESTful web services to manage them and the frontend view with Angular, CSS and HTML (all generated automatically). The objects that represent database's tables are entities.
With entities you can do CRUD queries on database using Java objects and Java methods with Spring framework. You can do queries by calling java methods. Thats all! After some practice it's really easy to use.
With that generator you don't have to configure relationships, constraints or things like that. Jhipster does that for you!
If you need a web application that does not use a database you don't need to use a generator like this, in my opinion.
I took the right Matt Raible's answer trying to give you more informations about entities. I hope to be helpful!
Have a nice day!

Dedicated database sharing between two apps on Heroku

I have two apps on Heroku and I would like them to use the same dedicated database. The problem is that this new app has the same models/tables than the other one.
My questions are:
Should I change the name for the tables on the new app?
If yes, what about the name of my models? Is it possible to map a model with a table with a different name? (Like User model with new_user table instead of user).
Any good advices on how to do this will be appreciated.
Thanks!
In general this is probably not as good an idea as it may seem. Rails is designed to assume it has 100% control over the database.
Even if you are able to get your tables separated and not colliding, you will still have challenges with the schema_migrations table. That table holds all the migrations for rails and would contain a mix of all migration records for both applications. This would confuse the apps whenever, for example, you tried to run rake db:rollback or other rake commands.
There could also be issues with having your schema.rb file potentially get out of synch between the two applications.
I'd recommend looking hard at the reasons you want to share the database and see if there are other ways to accomplish what you are trying to do. For example, you might consider using Active Resources to connect the applications restfully.