Need advices to link api and frontend containers in Rancher


I’m developing an application in node.js for backend api and Angular.js for the frontend.
I want that application to be easy to install for “non-tech” users computer so I use Docker to distribute it, so they just have to do docker-compose up/start/stop.

But I also want to propose it in a online demo, so I’m trying Rancher to orchestrate that :slight_smile:

So I’m running one node.js container to run my API service, and one nginx container to serve my angular.js static files.

My docker-compose.yml looks like this:

    image: myapi:latest
    image: myfrontend:latest
      - backend:backend
      traefik.frontend.rule: 'Host:'
      traefik.port: '80'
      traefik.enable: 'true'

And I’m setting a proxy_pass directive in nginx config to serve the backend API on the location

server {
    listen       80;
    server_name  localhost;

    location / {
        root   /app;
        index  index.html index.htm;
    location /api/ {
        proxy_pass   http://backend:1234/

This is working great with a standalone docker with docker-compose.

My problem is that when I’m doing an upgrade in Rancher to change settings on the backend container, the IP address change, and the nginx is still running with old proxy_pass config, so I have a “Bad Gateway” issue.
I need to manually restart frontend after a backend upgrade.

I thought of different solutions, but as I’m a beginner in Docker and Rancher, I would like to know your valuable opinion :slight_smile:
So what do you do when you’re facing similars problems ? What would be a good practice ?

  1. Put frontend as a backend’s sidekick to upgrade it in the same time ?
  2. Add a traefik label to the backend with a priority to serve it directly with traefik ?
  3. Not use nginx for that ?
  4. Do specific code in frontend to check changes in rancher metadata ?
  5. Check “Reuse IP address …” in container config ?
  6. any other idea ?

Thanks a lot if you read my topic! an thanks more if you want to answer me :slight_smile:

Congrats for all your work on Rancher, it’s very cool!