Enable ERP application to support multiple clients - php

The company has an ERP application that supports only once company using one database, how to make the application support multiple companies and multiple databases using the same code?
The application is a PHP and the database is MySQL.
Thanks.

It totally depends on the architecture of your application and your DB structure, if the refactor is too hard maybe the solution would be to have multiple instances of the ERP. Also as it is an ERP (with sensitive information of a company) you might have to install the instances in different servers, to ensure your clients won't be storing financial information with other companies in the same machine.
You can have one 'big' server virtualized. I'd suggest you to have a reverse proxy to redirect the requests from multiple subdomains to your virtualized guests. Also you can have a template of a virtualized server with Apache, PHP and your ERP installed ready to be installed in the virtualization host. When a client buy your product you just install and turn on that virtual guest and provide the client access.

You could re-install it on a second server. If you have a license to do that of course. What ERP application is it?
Edit:
For our ERP product, I use a segment of the url to distinguish the database. e.g.
http://myserver.com/company1/customers
versus
http://myserver.com/company2/customers
All urls that are embedded in documents are relative urls so they stay within the same company.

Related

How to handle infrastructure for the website in PHP which will be used many times?

I have a few PHP Laravel projects (restful API, admin app, client app). There is only one database which is used by API. The project is some kind of app which can be used by some companies. They have access to admin panel, client web page, they can use own API, they can make own users, permissions and so on. There is no problem if this project will be used by one client, but I'm going to sell this app to many people. I will be responsible for updates, hosting, configurations etc. I wonder how to make it the best way and I have a few ideas.
I thought about cloning the app on the server each time someone buys it from me. This requires setting up a new subdomain on the server and a lot of disk space. Not sure about it.
Or maybe cloning the app and sharing some files with symlinks like vendor, node_modules etc.
Another idea is to make it as a one project with many databases for different clients, but how to make it in Laravel in the best way? I will need some dynamic way to change the database connections (I want each client to have separate database), I'm not sure about conflicts with sessions, cache etc.
Maybe separate databases is a wrong idea, and it's better to have one database and make it as a one project and sell the access to project? But then I need to keep data of my client in one database.
What do you think?
Create this application as SaaS (software as a service). You can give them some default templates of front end or even client app (website and admin part), but keep all backend at your servers. Make REST endpoints, authenticate clients and give them functionality that they bought.
For example:
Client A bought calculator services from you. It authenticates, and makes GET call to /api/calculate/subtract/5/1. You give them response what your calculator does, for example 5-1 = 4. They can use your prepared templates for this data preview or create their own.
Client B bought calculator and storage services from you. You calculate same value, give it back, but also store it in your own database. So client B also can make call GET /api/storage/last_calculation and you give them 4, because client data stored in your database, he bought storage service too so he do not need to setup database for himself.
It is very simple example, but you should get the point.
For example simple scheme with separate database for each client:

Limit resources to tenant in apache multi tenant configuration

I'm going to deploy a multi tenant cloud service based on LAMP stack.
Each user has his own third domain .myservice.com, thus its own virtual host in Apache.
I'm wondering if it is possible and how I could limit resources any single virtual host can absorbe, so that even in case of high load from an user, it's not allowed to slow down too much the whole machine.
It's not really a multi tenant software at the moment, as each customer has a separate database and currentlu I use separate web folders containing the same project file.
This is not the best solution, but it's not the subject of this question and probably in the next future I'm going to use a single web folder for ann the users, with separate databases.
I'm using the standard apache-php configuration so that all is running under www-data user.
I'd really appreciate any kind of help.
Thank you,
Michele
Have a look at techcello.com. They have built a SaaS framework in .NET covering all of your requirements from tenant on-boarding, subscription, billing, trial management, notifications, data backup and much more which can be used to kick-start any SaaS product.
As per you requirement you have complete control of your data since they just provide you the binaries and you need to host it yourself.

How can I create an Amazon S3 clone on my host?

I am currently building a storage service, but I am very small and don't want to setup or pay for an Amazon S3 account. I already have my own hosting service which I want to use. However, I want to make it simple to switch to Amazon S3 if the need arises. Therefore, I would like to have essentially an S3 'clone' on my server, which I can simply redirect to amazons servers at a later time. Is there any package that can do this?
EDIT: I am on a shared server where I cannot install software, so is there a simple php page that can do this?
Nimbus allows for that. From FAQ:
Cumulus is an open source implementation of the S3 REST API. Some
features such as versioning and COPY are not yet implemented, but some
additional features are added, such as file system usage quotas.
http://www.nimbusproject.org/doc/nimbus/faq/#what-is-cumulus
http://www.ubuntu.com/cloud
you would need several host computers but it works well.
I too have a backup service, but it's based on several 48TB raid arrays.

Is it possible to run PHP and WCF on the same Azure instance?

I'm investigating the possibility of hosting a CMS (wordpress written in php) on Azure. I'm already running an ASP.NET Web Role which exposes WCF services. WordPress requires PHP. All my research suggests that I should create a new CGI Web Role to handle the PHP functionality. Is it possible to run the CGI Web Role and the ASP.NET Web Role under a single Azure instance? Or will I need two instances (one for asp.net; other for cgi)?
Actually, the "CGI Web Role" is just a web role with some FastCGI settings already populated. You can still put ASP.NET (or WCF services) there alongside the PHP. See http://blog.smarx.com/posts/php-asp-net-in-windows-azure for an example (but the demo app is no longer up).
You should look at the latest Windows Azure Companion that will let you do this. This will install an administrative website in a worker role and let you then install PHP-based tools such as WordPress, along with PHP itelf, via menu.
If you look at the source code of the Azure Companion, you'll see how the hosted web core is being launched. If you need to customize things beyond what the companion lets you do, you have all the code you need right there.
In a worker role, you can host multiple TCP ports, so it's very reasonable to have background workers running in the same role instance as your WordPress site.
Slightly unrelated: In a Web Role, you can still have background processes, but you'll just be unable to open arbitrary ports. You'll be fine creating, say, queue listeners. Just fire up your code in the Run() method (you'll need to add this, as it doesn't get added by default with a Web Role, only in the Worker Role template).
The flexibility of the Worker role enables you to run almost anything, including IIS itself :) You can use a role to host your own instance of IIS Hostable Web Core, which can leverage a few more of the features of IIS (like multiple applications) and likely enable you to do what you are wanting with a single instance. I don't have a ton of experience doing this myself, just know its possible.
The best example I've seen is at Steve Marx's blog
http://blog.smarx.com/posts/build-your-own-web-role-running-hosted-web-core-in-windows-azure
Beyond that, search around for "hostable web core on Azure" and you'll find some good resources.

How to deploy and configure many copies of an application to multiple domains on the same server

We are about to begin work on an application that will eventually be deployed many times on one server. I am hoping to build a nice interface so that one of my coworkers can easily create new deployments of this application. The idea is to create a wizard with a series of options that will configure basic properties of each particular copy of the app such as color scheme, domain name, etc. Each copy of the application may be further tweaked independently down the line. I would like to know what is the best way to manage the automatic creation of users, the updating of domain name info and the deploying of copies of an application, with the ability to maintain certain discrepancies between each of these copies (such as installed plugins, different CSS) as we update the application in the future.
What I'm asking is extremely similar to the way StackExchange 1.0 functioned, where a user could configure several options and a customized version of the StackExchange would soon be up and running. How is this accomplished?
One thing you can do is have the web server set a variable based on the domain name and path, and then you can check $_SERVER for the value and choose the configuration based on that. Or if the application will only be run once per domain then just check $_SERVER['HTTP_HOST'].

Categories