Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to define config.js for st2web #165

Merged
merged 1 commit into from
Jan 25, 2021

Conversation

moonrail
Copy link
Contributor

Hello maintainers,

while testing and developing internally we've experienced the requirement, where we would have to access StackStorm in a subpath of a FQDN, e.g. sub.domain.tld/stackstorm.

For this configuration is required for Ingress and st2web.

This PR adds the possibility to define configuration for st2web.

Ingress is pretty straight forward and already supported, e.g.:

ingress:
    enabled: true
    annotations:
      kubernetes.io/ingress.class: nginx
      kubernetes.io/tls-acme: 'true'
      nginx.ingress.kubernetes.io/rewrite-target: /$1
    hosts: 
      - host: 'sub.domain.tld'
        paths:
          - path: '/stackstorm/(.*)'
            serviceName: st2web
            servicePort: 80
    tls:
      - secretName: 'tls-sub.domain.tld'
        hosts:
          - 'sub.domain.tld'

With this Ingress configuration, st2web is properly reachable.

By default st2web uses relative paths to its domain to access services like auth, api, and stream. So for our example, st2web would try to authenticate against sub.domain.tld/auth.

A solution is described here: https://github.com/StackStorm/st2web#connecting-to-st2-server

In short: Edit /opt/stackstorm/static/webui/config.js to include complete Endpoints for auth, api, and stream.

For our example config.js could be:

'use strict';

/* global angular */
angular.module('main')
  .constant('st2Config', {

    hosts: [
      {
        name: 'test',
        url: 'https://sub.domain.tld/stackstorm/api',
        auth: 'https://sub.domain.tld/stackstorm/auth',
        stream: 'https://sub.domain.tld/stackstorm/stream',
      }
    ]

  });

@pull-request-size pull-request-size bot added the size/M PR that changes 30-99 lines. Good size to review. label Dec 23, 2020
Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution! That's a nice composed feature 👍

I just left one comment before we can merge it.

templates/deployments.yaml Show resolved Hide resolved
@arm4b arm4b added the feature label Jan 17, 2021
@arm4b
Copy link
Member

arm4b commented Jan 17, 2021

Please also sync up your PR branch with the latest master, - that'll fix the helm-lint CI failures.

@moonrail
Copy link
Contributor Author

Rebased :)

@arm4b
Copy link
Member

arm4b commented Jan 19, 2021

Thanks @moonrail!
The only missing thing to merge it is checksum adjustment for the new configmap/deployment, see the review comment above ^^: #165 (comment)

@moonrail
Copy link
Contributor Author

@armab
Sorry, I've been busy and overlooked your comment - Checksum should be generated as with other deployments as of now.

@arm4b
Copy link
Member

arm4b commented Jan 25, 2021

You're definitely faster then I am with the other PRs :)

Copy link
Member

@arm4b arm4b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice feature, thanks a lot for implementation! 👍

@arm4b arm4b merged commit 09474ae into StackStorm:master Jan 25, 2021
@moonrail moonrail deleted the add_st2web_config branch January 25, 2021 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature size/M PR that changes 30-99 lines. Good size to review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants