Skip to content

Configure HTTPS

By default, TestGen serves its web UI and API over HTTP. To serve them over HTTPS, provide an SSL certificate and private key. When both are configured, TestGen serves the UI and the API over TLS.

Prerequisites

Tip

When installing with dk-installer, you can enable HTTPS during installation instead of afterward by passing the --ssl-cert-file and --ssl-key-file options. See Installation options.

Configure SSL

The configuration steps depend on the install mode.

Docker mode

  1. Navigate to the directory that contains the docker-compose.yml file for TestGen.

    • If the instance was installed using dk-installer.exe, the file can be located under "AppData\Local\DataKitchenApps".
    • If the instance was installed using dk-installer, the file can be located in the folder from which the Python installer was executed.
  2. Add the certificate and key as bind mounts on the engine service, so they are available inside the container.

    services:
      engine:
        volumes:
          - type: bind
            source: <path to certificate file>
            target: /dk/ssl/cert.crt
          - type: bind
            source: <path to key file>
            target: /dk/ssl/cert.key
    
  3. Add the following lines under the x-common-variables section to point TestGen at the mounted files.

    x-common-variables: &common-variables
     SSL_CERT_FILE: /dk/ssl/cert.crt
     SSL_KEY_FILE: /dk/ssl/cert.key
    
  4. Map the host's HTTPS port to the UI in the engine service's ports section, for example, to serve the UI on port 443.

    services:
      engine:
        ports:
          - 443:8501
          - 8530:8530
    
  5. If you set TG_UI_BASE_URL or TG_BASE_URL, update them to use the https scheme and the HTTPS port.

  6. Restart the application.

    docker compose up -d --wait
    

Pip mode

  1. Open the ~/.testgen/config.env file in a text editor.

  2. Add the paths to your certificate and key files (one variable per line, no quotes).

    SSL_CERT_FILE=<path to certificate file>
    SSL_KEY_FILE=<path to key file>
    
  3. If you set TG_UI_BASE_URL or TG_BASE_URL, update them to use the https scheme.

  4. Restart the application. Stop the running TestGen process with Ctrl+C in the terminal where it is running, then start it again.

    python3 dk-installer.py tg start
    

Note

If you terminate TLS at a reverse proxy (for example, NGINX) in front of TestGen, configure the certificate on the proxy instead and leave SSL_CERT_FILE and SSL_KEY_FILE unset.