0

Plan A

  1. Building a docker image for each Angular app
  2. Using the docker image independently probably in a separate container for each angular app
  3. One Nginx container that will host all the pluggable containers

So, step 1 and 2 and are straight forward, however, the part to make the containers pluggable to Nginx is not very clear to me. My main plan is to have each app as a separate service so that when I push changes I can restart the target service, not the whole platform.

Any ideas how make the containers pluggable or some different approach?

Plan B

To have all the apps into separate volume like vol-ngapp1,vol-ngapp2 attached to the Nginx container, however, how would I do the update procedure that way? - Do I need to restart the whole container or what?

Need plan C :) or something til Z :D.

Thanks.

Damjan Dimitrioski
  • 679
  • 2
  • 9
  • 20
  • Not sure to clearly understand what you want to do... I just guess that you want to host the Angular app. As Angular apps are nothing else than static content (if you do not user server side rendering) you could host it e.g. in an AWS S3 bucket which does all the scaling and caching stuff for you and deployment is just as easy. – Ludwig Jan 11 '19 at 10:22
  • Yes, I am aware that are static files, that's why I can't figure out what to with it and how to perform updates. – Damjan Dimitrioski Jan 11 '19 at 10:43
  • @Ludwig So if I have several volumes how do I update them? – Damjan Dimitrioski Jan 11 '19 at 10:44

1 Answers1

1

Plan A'

  1. Build a docker image for each Angular app, all served by their own nginx
  2. Launch them all in the same network
  3. In the same network, launch a nginx container N as reverse proxy
  4. To update, after bring up new services, just edit the conf file in N and hot reload

This solution uses more than one nginx but I think it's the most pluggable and scalable solution.

In Step3, nginx can be replaced by other reverse proxies (traefik for example) with better service discovery ability so you don't have to edit the config file manually.

Plan B is not as pluggable as A' because if you have a new app online, you can't attach a volume to a running container without downtime. But you will be fine if you just want update an existing project (simply edit the volume).

Siyu
  • 11,187
  • 4
  • 43
  • 55
  • Wow, this traefik has web ui, nice, I will need some time to graps all of this, I was just thinking about having nginx in each angular app. So I 1. build an image and publish it in my local registry. 2. I rebuild container having the app, correct ? – Damjan Dimitrioski Jan 11 '19 at 10:55
  • But compared to this: https://github.com/jwilder/nginx-proxy ? Instead of traefic, cause I will need Let's encrypt as well – Damjan Dimitrioski Jan 11 '19 at 10:58
  • "So I 1. build an image and publish it in my local registry. 2. I rebuild container having the app," I don't think I understand your question. – Siyu Jan 11 '19 at 10:59
  • Sorry, let me rephrase it (I was saving space earlier :P). 1. AppService1 having my angular custom image (Using Dockerfile), which I rebuild the image and push to my custom docker registry. 2. I pull and rebuild my container on the server. Is this a good update procedure? – Damjan Dimitrioski Jan 11 '19 at 11:03
  • Traefik has Let's encrypt support as well. I think they both offer almost the same things: service discovery, https... you can choose either – Siyu Jan 11 '19 at 11:03
  • Ok, traefik it is then, let me pack nginx in my angular Dockerfile and see what will happen. – Damjan Dimitrioski Jan 11 '19 at 11:04
  • 1
    correct. build locally, push, pull on the server, run the new image (replacing the old container) – Siyu Jan 11 '19 at 11:07
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/186533/discussion-between-damjan-dimitrioski-and-siyu). – Damjan Dimitrioski Jan 11 '19 at 12:03