Skip to content

Update WebIde config to accept ports

In order to implement https://gitlab.com/gitlab-org/gitlab-ee/issues/5276 we need several modifications on the Web ide configuration. We need to accept a ports section in both the main image section and in each service one.

This is an example of the new ports options in .gitlab-webide.yml:

terminal:
  image: 
    name: alpine:3.9
    ports:
      - 80
  services:
    - name: tomcat
      alias: tomcat
      ports:
        - external_port: 8080      
          insecure: true
    - name: tomcat
      alias: tomcat2
      ports:
        - external_port: 8080
          internal_port: 80
          name: main_port
        - external_port: 8081
          name: secondary_port
    - name: tomcat
      alias: tomcat3
      ports:
        - [8080, 80]

The ports configuration can accept different options:

  • Only one port. In this option the internal_port is the same as the external_port.
  ports:
    - 80
  • An array of two values. In this option the first value is the external port and the second one the internal.
  ports:
    - [80, 81]
  • A hash. The accepts the keys: external_port, internal_port, insecure and name.

    • If no internal_port is set, the value of external_port will be used
  ports:
    - external_port: 8080
      internal_port: 8081
      insecure: false
      name: port_name
  • By default all services are insecure=false (which means that SSL is enabled)

  • Inside the same service, you can't have different ports pointing to the same external or internal port.

  • Each internal_port must be unique within the configuration

  • If there is more than one service you are forced to set a port name.

  • If only one port is set, default_port will be used as the port name

  • When the proxy endpoint is requested you can use either the number or the name version of the port

Edited by Francisco Javier López