3

I have a micro-services based JHipster app and have generated a Kubernetes deployment script using the kubernetes sub-generator.

I have deployed the app to Azure AKS and have it running smoothly. The current profile it is running with is 'prod'. How can I change the active profile the 'dev' in order to view swagger documentation?

Omtara
  • 2,911
  • 2
  • 19
  • 31

2 Answers2

7

I managed to get the swagger API functional by adding swagger to the SPRING_PROFILES_ACTIVE environment variable for all containers' deployment file.

spec:
  ...
  containers:
    - name: core-app
      image: myrepo.azurecr.io/core
      env:
        - name: SPRING_PROFILES_ACTIVE
          value: prod,swagger
Omtara
  • 2,911
  • 2
  • 19
  • 31
  • 2
    I confirm that this is the way I intended it to be used when I coded this feature in JHipster. You should never enable the dev profile outside of your local machine. – Pierre Besson Sep 16 '19 at 13:13
  • @PierreBesson i'm running the app on heroku and I need swagger on prod with no auth; I have added swagger profile to mvn build parameters, to SPRING_PROFILES_ACTIVE variable and enabled all swagger related urls in SecurityConfiguration.java, but still getting the swagger index page not able to load neither swagger-ui/dist/css/typography.css nor swagger-resources/configuration/ui and getting redirect there. Should I enable it somewhee in angular configs part or not? – Eljah Apr 17 '20 at 20:13
  • @PierreBesson I'm sorry, I have forgotten the Procfile used for heroku which actually drives the profiles used. It had no mention of swagger, that's why – Eljah Apr 17 '20 at 20:55
0

For everyone who is here because want to google out why the swagger isn't enabled on prod in heroku installation despite of setting it into application-prod.yml, application-heroku.yml, SPRING_PROFILES_ACTIVE env variable, mvn start-up parameters in MAVEN_CUSTOM_OPTS env variable in heroku:config custom env variables...

It looks like the actual profile that will be used by the heroku prod run is in Procfile.

Eljah
  • 4,188
  • 4
  • 41
  • 85
  • I think you might need to open a new question for that as it is entirely different than the one asked here. – Omtara Apr 24 '20 at 12:48
  • Right, but I was supposed it to be the same, until got realized that heroku case it something different, that's why I reached this question :) Hope my comment will help people got faced exactly my case – Eljah Apr 24 '20 at 16:52