0

I was running a complete CI stack on some local servers that I try to migrate to Rancher.

  1. First, I have created the following configuration on one node with docker-compose that seems to runs perfectly (i.e., I can access to each elements separately via external public subdomains).
    • jwilder/nginx-proxy
    • jrcs/letsencrypt-nginx-proxy-companion:latest
    • registry:2.6.2
    • rancher/server:latest
  2. Now, I want to access to some elements from brand new rancher stacks via their respective external public subdomains. For instance, https://gitlab.example.com, https://jenkins.example.com. Unfortunately, it doesn't work.

Actually, when I upload the following docker-compose.yml file when creating a stack, it looks like not being able to make the connection with the existing stack, the one which supports rancher itself and basically, I cannot access to the services which are running fine:

version: '2'
services:
  gitlab:
    image: gitlab/gitlab-ce:latest
    labels:
        io.rancher.container.pull_image: always
    ports:
        - "27100:80"
        - "27143:443"
        - "27122:22"            
    restart: always
    volumes:
        - /var/gitlab_volume/config:/etc/gitlab
        - /var/gitlab_volume/logs:/var/log/gitlab
        - /var/gitlab_volume/data:/var/opt/gitlab
    environment:
        VIRTUAL_HOST: "gitlab.example.com"
        VIRTUAL_PORT: 80
        LETSENCRYPT_HOST: "gitlab.example.com"
        LETSENCRYPT_EMAIL: "admin@example.com"  

What is the appropriate approach?

For info, I have already checked Rancher external subdomains but at this stage, I want to use my nginx server as load balancer.

Jack Admin
  • 307
  • 1
  • 13
  • 1
    The issue that one stack compose will run `jwilder/nginx-proxy` in a separate network and the other compose will be run in a separate network. So you need to run gitlab in the network of your existing stack as well. i don't have rancher installed to give you specific instructions but if you understand the issue, then you would know how to fix it – Tarun Lalwani Sep 21 '17 at 09:55
  • forcing the network mode greatly helps! I have forced network mode in both docker-compose.yml files. Thanks a lot! – Jack Admin Sep 21 '17 at 12:40
  • Do post the detailed steps as answer and accept it – Tarun Lalwani Sep 21 '17 at 12:41

1 Answers1

0

Here the final docker-compose.yml file definition:

version: '2'
services:
  gitlab:
image: gitlab/gitlab-ce:latest
network_mode: bridge
labels:
    io.rancher.container.pull_image: always
ports:
    - "27100:80"
    - "27143:443"
    - "27122:22"            
restart: always
volumes:
    - /var/gitlab_volume/config:/etc/gitlab
    - /var/gitlab_volume/logs:/var/log/gitlab
    - /var/gitlab_volume/data:/var/opt/gitlab
environment:
    VIRTUAL_HOST: "gitlab.example.com"
    VIRTUAL_PORT: 80
    LETSENCRYPT_HOST: "gitlab.example.com"
    LETSENCRYPT_EMAIL: "admin@example.com" 

We just need to force the network_mode on each container definition.

Jack Admin
  • 307
  • 1
  • 13