<p>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.</p>

<p>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.</p>

<p>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.</p>

<p>So how would the flow generally look like:</p>

<ol>
<li>You have your application codebase, that can cater for <strong>all</strong> of your customers</li>
<li>You build the docker container for your application (one for the frontend, one for the backend, possibly a few more supporting ones)</li>
<li>You have a deployment script that uses a configuration file to determine where to deploy and what.</li>
<li>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.</li>
</ol>

<p>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:</p>

<pre><code>config.js:

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

config.php:

define('CUSTOMER_LOCALE','es');
define('CUSTOMER_BETA','true');
</code></pre>

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

CC BY-SA 3.0
2017-03-07T09:52:54.237Z
Thanks. That is, mainly, what I need and a good starting point. Out of curiosity: why would you suggest many docker images for one customer?
axtho
CC BY-SA 3.0
2017-03-07T10:01:21.663Z
@axtho not mandatory, although it's usually a good practice to separate each concern (frontend, backend, database, etc.) into a separate container, so they can be deployed and scaled independently
SztupY
CC BY-SA 3.0
2017-03-06T11:23:46.303Z
2017-03-06T11:23:46.303Z
SztupY
<p>I am working on an Angular2 project with Yii2 (PHP/MySQL) as its API point. We will need to deploy the Angular app in different languages for different customers (using AOT compilation from angular-cli).</p>

<p>What is the best way to achieve this? I am looking at Docker or Ansible(-container) to make this work. But the examples are mainly for a 1:1 setup. But I would need a 1:n, something like:</p>

<p><code>deploy app-de new_costomer prod_server</code></p>

<p>Additional to that, when a new version of the app is available i want to update the entire network with the new app (that requires uploading of the src/ folder AOT compiled, and db migration scripts on the Yii2 side).</p>

<p>Ideally it would do something like:</p>

<p><code>deploy update network-all prod_server</code></p>

<p>Any ideas?</p>

<p>To clarify: I have a number of customers, each customer should get its own container (docker, through ansible-container). There is the AOT compiled Angular stuff (just JS) and the PHP backend with MySQL.</p>

<p>Each customer gets this setup on a server (so 3 customers = 3 docker containers with the Angular + PHP + MySQL).</p>

<p>We push updates to both Angular and PHP quite frequently (i.e. the entire DIST folder needs to be uploaded or at least a diff, migrations scripts for the PHP/MySQL backend needs to run, etc.).</p>

<p>And this from one command (because I obviously do not want to have SSH into each container to do all that semi-manually).</p>

<p>Since I have never done this kind of setup before, I would like to get some ideas on how this can achieved with things like Ansible (or the like).</p>

CC BY-SA 3.0
2017-03-02T15:24:25.317Z
It's not very clear what you're asking for.  It sounds like your general issue is internationalization.  That is typically an application design issue, not a deployment issue.  You *could* deploy different languages as separate containers, but I'm not sure that would be the simplest or most efficient solution.
Dave Swersky
CC BY-SA 3.0
2017-03-02T15:51:51.560Z
Looks like a copy-pasted question from another site, including the SE links and icons around the question. Fix the formatting and please make this question clear to understand and to answer.
Evgeny Zislis
CC BY-SA 3.0
2017-03-03T18:20:09.877Z
Hey @Evgeny, yes it was copied from my post on Stackexchange, where someone commented on this and told me to take it over here. Hence the dupliciation. I updated the issue above.
axtho
CC BY-SA 3.0
2017-03-03T18:24:32.063Z
@axtho [Cross-posting is generally discouraged](http://meta.stackexchange.com/questions/64068/is-cross-posting-a-question-on-multiple-stack-exchange-sites-permitted-if-the-qu?noredirect=1&lq=1)—you should either have the post on this site or on Stack Overflow, not both. That's probably why your question hasn't been received very well.
Aurora0001
CC BY-SA 3.0
2017-03-03T22:43:53.750Z
Better with the edit , don't specify "edit " looking at revision we can know what have been added and in the review queu the changes are highlighted. voting to reopen
Tensibai
CC BY-SA 3.0
2017-03-04T18:43:43.613Z
Ok. I deleted the post on StackOverflow. Thanks for the help on the edits.
axtho
<deployment><ansible><docker>
How to implement Continuous Deployment in Angular, PHP API and Ansible projects?
axtho
# How to implement Continuous Deployment in Angular, PHP API and Ansible projects?

(Asked by: username_0 on 2017-03-02)

I am working on an Angular2 project with Yii2 (PHP/MySQL) as its API point. We will need to deploy the Angular app in different languages for different customers (using AOT compilation from angular-cli).

What is the best way to achieve this? I am looking at Docker or Ansible(-container) to make this work. But the examples are mainly for a 1:1 setup. But I would need a 1:n, something like:

`deploy app-de new_costomer prod_server`

Additional to that, when a new version of the app is available i want to update the entire network with the new app (that requires uploading of the src/ folder AOT compiled, and db migration scripts on the Yii2 side).

Ideally it would do something like:

`deploy update network-all prod_server`

Any ideas?

To clarify: I have a number of customers, each customer should get its own container (docker, through ansible-container). There is the AOT compiled Angular stuff (just JS) and the PHP backend with MySQL.

Each customer gets this setup on a server (so 3 customers = 3 docker containers with the Angular + PHP + MySQL).

We push updates to both Angular and PHP quite frequently (i.e. the entire DIST folder needs to be uploaded or at least a diff, migrations scripts for the PHP/MySQL backend needs to run, etc.).

And this from one command (because I obviously do not want to have SSH into each container to do all that semi-manually).

Since I have never done this kind of setup before, I would like to get some ideas on how this can achieved with things like Ansible (or the like).

**Tags:** deployment, ansible, docker

> **Comments:**
> **username_1**: It's not very clear what you're asking for.  It sounds like your general issue is internationalization.  That is typically an application design issue, not a deployment issue.  You *could* deploy different languages as separate containers, but I'm not sure that would be the simplest or most efficient solution.  
> **username_2**: Looks like a copy-pasted question from another site, including the SE links and icons around the question. Fix the formatting and please make this question clear to understand and to answer.  
> **username_0**: Hey @Evgeny, yes it was copied from my post on Stackexchange, where someone commented on this and told me to take it over here. Hence the dupliciation. I updated the issue above.  
> **username_3**: @username_0 [Cross-posting is generally discouraged](http://meta.stackexchange.com/questions/64068/is-cross-posting-a-question-on-multiple-stack-exchange-sites-permitted-if-the-qu?noredirect=1&lq=1)—you should either have the post on this site or on Stack Overflow, not both. That's probably why your question hasn't been received very well.  
> **username_4**: Better with the edit , don't specify "edit " looking at revision we can know what have been added and in the review queu the changes are highlighted. voting to reopen  
> **username_0**: Ok. I deleted the post on StackOverflow. Thanks for the help on the edits.  

---

## 1 answers

### Answer by username_5 on 2017-03-06. Score: 7 | Accepted answer

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.

> **Comments:**
> **username_0**: Thanks. That is, mainly, what I need and a good starting point. Out of curiosity: why would you suggest many docker images for one customer?  
> **username_5**: @username_0 not mandatory, although it's usually a good practice to separate each concern (frontend, backend, database, etc.) into a separate container, so they can be deployed and scaled independently  

---

