Deploy & Manage client/server application on multiple client servers - php

We're currently developing a 'sort of' e-commerce platform for our customers that are using our POS system.
This mainly exists of:
An Angular client-side
A PHP API as back-end
A MySQL database
Before I distribute the application to clients, I want to have a 'manageable' system for deploying and updating their platforms in case of code changes etc.
The initial setup would be:
Create database
Copy PHP files
Run composer
Run migrations
Modify configuration file for database credentials, salts, domain,..
Copy client side files
I was looking at Deployer for PHP, but I'm not sure how the whole database creation and config file modifications would work. I've originaly have the database creation in one of my migrations, but this would require a root db-user (or one with create permissions) and this user would need to be created as well.
The intial setup part could be done manually (it's not like it will be more than 5+ installations per week or so, but I would like to make it as simple as possible so that our support can do this instead of me every time)
The next part would be Updates.
I don't want to FTP to every server and apply changes. Updates can be both server side and client side. What would be the best way to do this:
Have a central system with all versions and registered websites at our end and let the client server daily check for a new version. If there is a new version, download all files from our server and run the migrations.
Push via deployer the new version to all clients. But this would overwrite or move the original config file with the DB credentials etc with the new version?
What if I need to add a new config setting? (application settings are stored in the database, but like the 'API' settings are within a config file.)
There will be a chance that all these client-servers will be distributed via our hosting provider, so we'll have access to all of them and they'll all be the same (for the configuration and such)
I've only written web applications used on one (server) location, so updating those were easy, for example via deploybot and such and the database setup was done manually, but now I'm stepping up my game and I want to make sure that I don't give myself more work than it should be.

Here's our case on developing an e-commerce platform - maybe you'll find answers to your questions there.
Codenetix spezializes in custom development, mostly web apps, so if you need help - let us know.
Good luck with your project!

Related

Update PHP and MySQL server instances

I am working on a mobile application that communicates with an IIS server to synchronize data among application users.
The server is implemented in PHP and MySQL. The final procuct will consist of the server and the application. In other words, every client (company) is going to use a different server and the employees of each company will be the users of the mobile application. As soon as the application is released, bugs are expected to come up. Therefore, each synchronization server will require updates. The db schema and the PHP code will probably need to be altered. Using git to have clients fetch the most recent version of the server is not an option since the clients are not able to handle issues such as merge conflicts.
I need to automate the update process as much as possible. Is there any tool or piece of advice that would help me do so?
Thank you in advance for your assistance.
I would suggest for the MySQL part to write you own migartions(PHP scripts) which if carefully tested should do the DB migrations correctly. The customers MUST be forbidden to modify the database or you'll never be able to handle migrations correctly.
The second part with PHP sync, I really don't understand what's the problem using git - I think that the right way to go. I don't understand your concerns about the conflicts because the customers wont have to deal with this. When you merge the branches you will have to deal with the conflicts yourself and after you push it to the git server the clients will only have to "pull" the new version.
So to finalize you should create a script that when a new version is available should git pull the version and after that execute the DB migration script(if any).

What is the best way to control Flex + PHP software version?

SWho works with cached clients system knows that sometimes you have to update server and client files. So far I've managed to solve partially the problem, by making one call every time the software is opened to ask PHP what version of the software he's in. With the result, I compare to the version that Flex is in and voalá. Problem is, whenever I need to make an emergency update inside the business hour range, it's impossible to know how many clients have the Flex version already opened.
So to sunup: The cache problem I solved by controlling the version in start-up time, if your browser cached it, the version won't match with the server's app.
The only solution I can think to solve the 'already opened app' problem is to make a gateway between the PHP Services and Flex calls, where I would have to pass the Flex version and compare it inside the gateway, before the service is actually called, although I don't like this solution.
Any ideas?
Thanks.
You can download this application from Adobe website. http://labs.adobe.com/technologies/airlaunchpad/ It will allow you to build a new test app, and you need to select in the menu : "auto update" property. That will generate all the necessary files for you both for server and client.
The end result will have a server based xml file, and setup in each of the client apps to check on recurring basis if the xml file offers newer version of the application, and if true, automatically downloads and updates it. You can update the "check for update" frequency to your liking in the source code, by default it is tied to the application open event.
This frequent update will check for updates also while app is open, so it should solve your problem.

Which is more logical & better performing? One CI App or multiple CI apps

I have a CodeIgniter app in a git repo. Currently i deploy a new installation on my server for each new client i signup.
Each new client has its own database and its own files in a folder such as: /var/www/vhosts/example.com/client/client1/
Each client gets a subdomain that i map out through plesk. client1.example.com.
My question:
Is it better performing to have a single app setup to manage all of these client installations with different database.php config files.
IE: /var/www/vhosts/example.com/httpdocs/*
and use a htaccess redirect for the sub domains to remap the URI to different configs.
Or is it better performing to have a seperate installation for each client like i listed above.
Server Information:
PHP 5.3
MySQL 5.x
CodeIgniter 2.1
WireDesignz HMVC
Sparks (various)
CentOS DV4 from MediaTemple
I'd say keep them apart.
Each client will have their own set of requirements. While the Server won't change that much , your code base will. It will become hard over time NOT to break something for one client while building something for another.
As they will be separate projects you'll be able to move larger sites away from the smaller sites. But this depends on what type of traffic you're clients receive.
And having each Application in it's own Repository (You are using Version Control, Right ?) would make your world that much more organized.
Performance wise the smaller application designed for a client, and only running what they want will probably outperform one monolithic site serving all your clients any day.
Hope I understood that correctly, it's my personal opinion.

Suggestion for upgrading VB6 app w/ good printing support

I wrote an application on VB6/Access for a retail shop almost 8 yrs ago. They are still using it, and now they are asking for changes/upgrade and want to access from multiple locations + multiple machine per location. Earlier it was just one machine per location.
All location is going to run the same application except only the Inventory and customers are different along with app settings. Inventory should be able to move to different location.
I lost touch with VB & Access, also I would like to rewrite the app with open source tools.
I'm a web developer PHP/MySQL and can do html5 if necessary. I believe I can rewrite all the functionalities with PHP/MySQL but I am not confident in printing.
The main requirement of the app is, it should print as fast as it can, should support several custom paper sizes.
Also the database should work distributed environment, all location should be able to work independently as well as able to sync updates when connected.
What is the best thing I can do in
this situation?
Would you recommend to create webapp, and do any desktop
client only for printing. i.e VB in
windows or shell script if linux? or
any alternative?
Any recommended workflow/links for Database setup/mirroring?
Modify the existing VB application to run with required MySQL architecture?
Sorry to violate one question per post rule, but I don't know how to split it.
Lets start with printing.
You could do a print CSS file. But its not very precise. That would get printed from the client browser.
Generate a PDF. With that you could print from the server or from the client. Server would be a faster option. Although multiple printers could get complicated.
Database sync:
I would treat the central database as a separate app and devise rules for each location to sync to the central location. You may not need to share all data, and just replicating the data you get into complex replication rules.

PHP/mysql application creation process

I am trying to figure out how one would start the setup of a small CMS.
I have the groundwork built, but the step of creating the database tables in mysql, should this all be done at once in a install.php file? Is there a preferred method for creating many tables at once, even if I don't need to insert data into them at this time?
You can
Import the schema file to your database prior to deploying the application
You can have a script that creates the schema
You can have a script that makes any changes to the current schema (for upgrades)
For a small CMS, I'd just keep the SQL in a schema file and import it when I need it.
You could also do a database copy from your dev -> live system. So you make the changes in the dev database as you need them and then push them to the live database. Something like SQLCompare for SQL Server works well.
Wordpress does the install.php route, where you have to enter your credentials and such for the target database and it then pushes the changes to it.
If you're going to be distributing your application for 3rd parties to install on their own servers, a very common approach is to provide (as you said) a simple install.php file. If your application is more complicated, often times an installation directory will come packaged. The user installing the application opens this in a browser, where your script typically does a few things:
Check PHP installation - verify (using function_exists()) all the required functions (and thus libraries) are installed and available. Alert the user of anything missing.
Allow the user to enter their configuration parameters - application specific settings required. Typically database hostname, username & password.
Test database connection - if successful, load initial tables. Commonly you keep your base schema file stored as a SQL file, so the application pushes this through the native mysql client, or issues the individual SQL commands directly.

Categories