DEV Community

Discussion on: The complete guide to setup a CI/CD for Rails 6+ on Gitlab

Collapse
 
zimski profile image
CHADDA Chakib

Hello Patrik, thankyou for your comment.

To solve your issue, I will proceed like this:

  1. Find the hostname of the main container that run your rails app in gitlab CI, in the rest of this comment, I will refer to it as [HOSTNAME]

  2. setup a test domain with sub-domains using CNAME ( you can use route53 from aws for this) :

  subdomain1.example-ci.com CNAME [HOSTNAME]
  subdomain2.example-ci.com CNAME [HOSTNAME]
  ...
  1. in your rails app, setup the links generator to use subdomains

The result will be:

  1. Rails will generate domains using *.example-ci.com
  2. Selenium will resolve this domain and get [HOSTNAME] as the first result it will try to resolve [HOSTNAME] a second time and will find the IP because all services and the main container are linked together gitlab service alias
  3. selenium will send the http requests to the right container containing your rails app

Hope this help you

Merry Christmas