Skip to content

Update basepath/route for the application

The updates required to make the application work with basepath (say bar):

1. Change the Gitlab OAuth URLs to include basepath:

1
2
3
  REACT_APP_AUTH_AUTHORITY: 'https://gitlab.foo.com/',
  REACT_APP_REDIRECT_URI: 'https://foo.com/bar/Library',
  REACT_APP_LOGOUT_REDIRECT_URI: 'https://foo.com/bar',

2. Update traefik gateway config (deploy/config/gateway/fileConfig.yml):

http:
  routers:
    dtaas:
      entryPoints:
        - http
      rule: "Host(`foo.com`)" #remember, there is no basepath for this rule
      middlewares:
        - basic-auth
      service: dtaas

    user1:
      entryPoints:
        - http
      rule: "Host(`foo.com`) && PathPrefix(`/bar/user1`)"
      middlewares:
        - basic-auth
      service: user1

  # Middleware: Basic authorization
  middlewares:
    basic-auth:
      basicAuth:
        usersFile: "/etc/traefik/auth"
        removeHeader: true

  services:
    dtaas:
      loadBalancer:
        servers:
          - url: "http://localhost:4000"

    user1:
      loadBalancer:
        servers:
          - url: "http://localhost:8090"

3. Update deploy/config/client/env.js:

See the client documentation for an example.

4. Update install scripts:

Update deploy/install.sh by adding basepath. For example, add WORKSPACE_BASE_URL="bar/" for all user workspaces.

For user1, the docker command changes to:

docker run -d \
 -p 8090:8080 \
  --name "ml-workspace-user1" \
  -v "${TOP_DIR}/files/user1:/workspace" \
  -v "${TOP_DIR}/files/common:/workspace/common" \
  --env AUTHENTICATE_VIA_JUPYTER="" \
  --env WORKSPACE_BASE_URL="bar/user1" \
  --shm-size 512m \
  --restart always \
  mltooling/ml-workspace-minimal:0.13.2 || true

5. Proceed with install using deploy/install.sh: