How to implement Continuous Deployment in Angular, PHP API and Ansible projects?
Let's assume you have the following scenario: You have many customers, but most use the exact same app, except for some configuration changes. You would like each of your customer to get the latest of the app ASAP.

If this is your scenario then try make everything that needs to be differentiated between the apps a configuration change. You build one (or one set of) docker containers that can handle any of your customer based on the configuration it was given. Then on deployment time you simply supply the proper configurations for this container for each of your customer.

The benefit of this approach is that you don't really incur massive overheads when a new customer comes. You generate their configuration, create the new servers, add some entries into an inventory file, and the next time you deploy, it gets there as well. The more well your CD pipeline is set up the more you can automate any of this process.

So how would the flow generally look like:


You have your application codebase, that can cater for all of your customers
You build the docker container for your application (one for the frontend, one for the backend, possibly a few more supporting ones)
You have a deployment script that uses a configuration file to determine where to deploy and what.
You run this deployment script. It will go over all of your customers, and simply deploy the latest version of your app with the appropriate config.


If you have a new customer, the only place you have to change is the deployment configuration file. If you are using ansible most likely you have to change your inventory and your vars file. Let's say you have get a new customer, who would like the app to run under Spanish locale, and has access to the beta features. This customer's configuration would maybe look like this:

config.js:

SETTINGS = { locale: 'es', beta: true };

config.php:

define('CUSTOMER_LOCALE','es');
define('CUSTOMER_BETA','true');


You then make sure that during deployment your container gets these files mounted on startup.