How to Run/maintain "one" CI3 App hosted on multiple subdomains/ servers. |
Hi,
A year ago i've started developing an application in CI3. The general idea behind this was that every client would have a seperate (sub)domain with their version of the application/db (stand-alone) so each client worked in his own "bubble" with no connection to the others. Now a year later the amount of clients is growing and I currently have 10 subdomains with running the app. This is becoming a bit complicated to maintain when I want to update the app(s). I've been looking at deployment tools and services and i'm a bit lost here . My goal is to simultaneously update all my subdomains when i push to my git repo. and have the least amount of downtime. (Some of the clients have the application running on their own servers as well). Is there anyone with some experience with a similar problem / case? Alternatively i was think about putting the base source-code of the application outside the www/ folder and have all the subdomains use this code. So basically have a index.php in a subdomain where i include some constant variables which contain the config variables and the database connection information so it all uses one codebase (like codeigniter does with system folder). But i'm not sure that this is a good approach because well first of all passing constants in the index file (security risk?), one codebase -> one error and all clients are affected instead of one! And performance issues. As you might notice i have no idea what the best approach here will be. Advice on this matter would be very appreciated! Are there people who faced the same issue or who know how to handle these kinds of things. Any form of help is welcome, advice, tutorials, ... Thanks in advance! Best regards, Bart
Hello,
i am working on a similar project with 1 x CI and N x Clients. So to avoid all the maintanance on the CI i have 1 CI in 1 domain and all the clients has seperate segment. so blabla.com/client1/"the rest of the site", the basic controller is 1 and i have routes to avoid write the controllers etc. so when client1 trying to access the site the route redirect the client1 to controller/client1 and in the controller i use the segmenet 1 to do the db connections etc. I have an admin DB with all the info of the other dbs encrypted etc but I couldnt avoid the multiple databases for the clients. But ofc if you do 1 mistake all sites will be down, but i guess if you have a demo page with the same configuration you can do the tests there and update the main page. you can move the system and app folder outside of the main domain for safety reasons mostly ( check here https://www.codeigniter.com/user_guide/i...index.html ). I am not sure if this is right or wrong heheheh
(08-01-2019, 01:52 AM)mboufos Wrote: Hello, That's also (somewhat) an approach which came to me last night but the base_controller is not an option for me. My main is indeed the database connections, and custom config variables. Your approach with the admin DB and encrypted entries is very nifty. So you just encrypt them with a salt of some sorts and decrypt them in the php files? I'm not sure about the right or wrong stuff either but thanks for sharing it helps in putting together a solution !
you can have different controllers for differest clients like
routes --> client1 go to --> client1/home routes --> client2 go to --> client2/home i dont know how complicated is your system but with routes you can redirect everything, about the dbs info in 1 db i use like aes-256-cbc with iv password etc and i encrypt/decrypt when i want. Btw you can keep the database connections in database file ( all of them ) and according to the site to load the info (i do this in models, so the controller will be clear you just pass the name on the db connection) If the project is like CRM which the clients must login to do what ever they want, just save in ccokie the client name and keep the routes file clean. hmm maybe you could save the client name on 1st entry in cookie and do the rest of the staff according to that(encrypted ofc)
(08-01-2019, 02:43 AM)mboufos Wrote: you can have different controllers for differest clients like The biggest problem is that some clients have their own server with their version of the application which makes this a real pain in the bumbum |
Welcome Guest, Not a member yet? Register Sign In |